Skip to content

Scope checking for require #11677

@samdark

Description

@samdark

hello.php:

<?php

function render(): void {
    require 'template.php';
};

render();

template.php:

<?php
/** @var string $name */
?>
Hello, my name is <?= htmlentities($name, ENT_QUOTES) ?>!

In the example template, `` is required to be defined in the scope of the require call, so I'd expect static analysis to detect the missing required scope variable.

// this is useful for "PHP templates" implementation

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