Skip to content

Avoid error with constant $ #4006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 1.12.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ parameters:
count: 1
path: src/Reflection/BetterReflection/BetterReflectionProvider.php

-
message: "#^Dead catch \\- PHPStan\\\\BetterReflection\\\\NodeCompiler\\\\Exception\\\\InvalidIdentifierName is never thrown in the try block\\.$#"
count: 3
path: src/Reflection/BetterReflection/BetterReflectionProvider.php

-
message: "#^Creating new ReflectionClass is a runtime reflection concept that might not work in PHPStan because it uses fully static reflection engine\\. Use objects retrieved from ReflectionProvider instead\\.$#"
count: 1
Expand Down
2 changes: 2 additions & 0 deletions src/Reflection/BetterReflection/BetterReflectionProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.1)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

Check failure on line 1 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\NodeCompiler\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php was not matched in reported errors.

namespace PHPStan\Reflection\BetterReflection;

Expand Down Expand Up @@ -112,7 +112,7 @@
return true;
} catch (IdentifierNotFound) {
return false;
} catch (InvalidIdentifierName) {

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.1)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 115 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.
return false;
}
}
Expand All @@ -130,7 +130,7 @@
}

$reflectionClassName = strtolower($reflectionClass->getName());

Check failure on line 133 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 133 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.
if (array_key_exists($reflectionClassName, $this->classReflections)) {
return $this->classReflections[$reflectionClassName];
}
Expand Down Expand Up @@ -175,7 +175,7 @@

$reflectionClass = $this->reflector->reflectClass($className);

return $reflectionClass->getName();

Check failure on line 178 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 178 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, ubuntu-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path /home/runner/work/phpstan-src/phpstan-src/src/Reflection/BetterReflection/BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 178 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.

Check failure on line 178 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, windows-latest)

Ignored error pattern #^Dead catch \- PHPStan\\BetterReflection\\Identifier\\Exception\\InvalidIdentifierName is never thrown in the try block\.$# in path D:\a\phpstan-src\phpstan-src\src\Reflection\BetterReflection\BetterReflectionProvider.php is expected to occur 3 times, but occurred 4 times.
}

public function supportsAnonymousClasses(): bool
Expand Down Expand Up @@ -434,6 +434,8 @@
return true;
} catch (IdentifierNotFound) {
// pass
} catch (InvalidIdentifierName) {

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.1)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 437 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.
// pass

Check failure on line 438 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 438 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.
} catch (UnableToCompileNode) {
// pass
}
Expand All @@ -450,7 +452,7 @@
?NamespaceAnswerer $namespaceAnswerer,
): ?string
{
$name = (string) $nameNode;

Check failure on line 455 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.

Check failure on line 455 in src/Reflection/BetterReflection/BetterReflectionProvider.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Dead catch - PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName is never thrown in the try block.
if ($namespaceAnswerer !== null && $namespaceAnswerer->getNamespace() !== null && !$nameNode->isFullyQualified()) {
$namespacedName = sprintf('%s\\%s', $namespaceAnswerer->getNamespace(), $name);
if ($existsCallback($namespacedName)) {
Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/AnalyserIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,12 @@ public function testBug12979(): void
$this->assertNoErrors($errors);
}

public function testBug12095(): void
{
$errors = $this->runAnalyse(__DIR__ . '/data/bug-12095.php');
$this->assertNoErrors($errors);
}

/**
* @param string[]|null $allAnalysedFiles
* @return Error[]
Expand Down
15 changes: 15 additions & 0 deletions tests/PHPStan/Analyser/data/bug-12095.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);

namespace Bug12095;

class HelloWorld
{
public const XXX = '$';

public function sayHello(): void
{
if(defined(self::XXX)) {
die(0);
}
}
}
Loading