{"id":18598455,"url":"https://github.com/backendtea/psl-phpstan-extension","last_synced_at":"2025-05-16T14:12:01.370Z","repository":{"id":62550055,"uuid":"496381275","full_name":"BackEndTea/psl-phpstan-extension","owner":"BackEndTea","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-25T20:43:23.000Z","size":7,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T23:48:16.162Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BackEndTea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-25T20:31:51.000Z","updated_at":"2022-06-03T17:38:56.000Z","dependencies_parsed_at":"2022-11-03T01:45:36.706Z","dependency_job_id":null,"html_url":"https://github.com/BackEndTea/psl-phpstan-extension","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackEndTea%2Fpsl-phpstan-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackEndTea%2Fpsl-phpstan-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackEndTea%2Fpsl-phpstan-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackEndTea%2Fpsl-phpstan-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BackEndTea","download_url":"https://codeload.github.com/BackEndTea/psl-phpstan-extension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544157,"owners_count":22088808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T01:32:46.426Z","updated_at":"2025-05-16T14:12:01.333Z","avatar_url":"https://github.com/BackEndTea.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPStan PSL extension\n\n## Description\n\nThe main scope of this extension is to help phpstan to detect the types after using `Psl\\Type\\shape`.\nIts intended to produce the same output as the [psalm plugin](https://github.com/php-standard-library/psalm-plugin).\nGiven the following example:\n\n```php\nuse Psl\\Type;\n\n$specification = Type\\shape([\n    'name' =\u003e Type\\string(),\n    'age' =\u003e Type\\int(),\n    'location' =\u003e Type\\optional(Type\\shape([\n        'city' =\u003e Type\\string(),\n        'state' =\u003e Type\\string(),\n        'country' =\u003e Type\\string(),\n    ]))\n]);\n\n$input = $specification-\u003ecoerce($_GET['user']);\n```\n\nPhpStan assumes that `$input` is of type `array\u003c\"age\"|\"location\"|\"name\", array\u003c\"city\"|\"country\"|\"state\", string\u003e|int|string\u003e`.\n\nIf we enable the extension, you will get a more specific and correct type of `array{name: string, age: int, location?: array{city: string, state: string, country: string}}`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackendtea%2Fpsl-phpstan-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbackendtea%2Fpsl-phpstan-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackendtea%2Fpsl-phpstan-extension/lists"}