Skip to content

"Class not found" error should not be reported for class_exists() call #2529

@ADmad

Description

@ADmad

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/fd399b9a-5b8a-4edc-a28a-c40317dcc5b3

<?php declare(strict_types = 1);

namespace Foo;

use APCuIterator;

class HelloWorld
{
	public function sayHello(): void
	{
		if (class_exists(APCuIterator::class, false)) {
			$y = new APCuIterator('/foo/');
		}
	}
}

Output

+---------------------------------------------------+
| Line | test.php                                   |
+---------------------------------------------------+
| 11   | Class APCuIterator not found.              |
| 12   | Instantiated class APCuIterator not found. |
+---------------------------------------------------+

Expected output

No errors should be reported.

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