Skip to content

Working with elements inside $_SERVER #8497

@pereorga

Description

@pereorga

What should be the preferred way to tell phpstan that $_SERVER['REQUEST_URI'] is a string, rather than mixed? For example here:

https://phpstan.org/r/a0b92a7e-d3e9-497f-b882-01fc99e22a36

In my use case, I know$_SERVER['REQUEST_URI'] will be set by the web server and that it will be a non-empty string.

Should I write a stub? I've tried defining types$_SERVER in a documentation block, but that doesn't seem to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions