https://github.com/albinodrought/repro-psalm-laravel-undefined-index
Reproduce psalm/plugin-laravel `Undefined index `issue
https://github.com/albinodrought/repro-psalm-laravel-undefined-index
Last synced: about 2 months ago
JSON representation
Reproduce psalm/plugin-laravel `Undefined index `issue
- Host: GitHub
- URL: https://github.com/albinodrought/repro-psalm-laravel-undefined-index
- Owner: AlbinoDrought
- Created: 2020-07-13T17:24:07.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T19:22:13.000Z (about 2 years ago)
- Last Synced: 2025-02-07T02:46:33.614Z (3 months ago)
- Language: PHP
- Homepage: https://github.com/psalm/psalm-plugin-laravel/issues/94
- Size: 398 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# psalm/plugin-laravel `Undefined index: wrap` repro
## Reproducing
### With Docker
`docker build -t repro . && docker run --rm -it repro`
### Without Docker
`./reproduce.sh`
## Report
### Triggering Code
```php
UserResource::$wrap = 'items';
```### Expected Outcome
No error, `$wrap` exists on base `JsonResource`. Works without `psalm/plugin-laravel` enabled.
### Actual Outcome
```
Getting /app/app/Http/Controllers/UserController.php
Analyzing /app/app/Http/Controllers/UserController.phpErrorException
Undefined index: wrap
at vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/StaticPropertyFetchAnalyzer.php:318
314| }
315| }
316|
317| $class_storage = $codebase->classlike_storage_provider->get($declaring_property_class);
> 318| $property = $class_storage->properties[$prop_name];
319|
320| if ($var_id) {
321| if ($property->type) {
322| $context->vars_in_scope[$var_id] = \Psalm\Internal\Type\TypeExpander::expandUnion(
```