Skip to content

Instantly share code, notes, and snippets.

View morria's full-sized avatar
✌️

Andrew Morrison morria

✌️
View GitHub Profile
<?php
use \Phan\Issue;
/**
* This configuration will be read and overlayed on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*
* @see src/Phan/Config.php
diff --git a/.phan/config.php b/.phan/config.php
index 31115ed..6361494 100644
--- a/.phan/config.php
+++ b/.phan/config.php
@@ -243,6 +243,7 @@ return [
'plugins' => [
'.phan/plugins/DemoPlugin.php',
'.phan/plugins/DollarDollarPlugin.php',
+ '.phan/plugins/PreAnalysisPlugin.php',
// NOTE: src/Phan/Language/Internal/FunctionSignatureMap.php mixes value without key as return type with values having keys deliberately.
<?php
// Issue::PhanAccessPropertyPrivate
class C1 { private static $p = 42; }
print C1::$p;
// Issue::PhanAccessPropertyProtected
class C2 { protected static $p = 42; }
print C2::$p;
diff --git a/src/Phan/Language/Scope.php b/src/Phan/Language/Scope.php
index d159507..90b609f 100644
--- a/src/Phan/Language/Scope.php
+++ b/src/Phan/Language/Scope.php
@@ -54,6 +54,8 @@ abstract class Scope
*/
public function getParentScope() : Scope
{
+ assert(!empty($this->parent_scope),
+ "Parent scope should not be null at $this");
<?php
function f($p0, DateInterval $p1 = null) {}
function g(DateInterval $p0 = null, $p1) {}
function j(DateInterval $p0 = null, $p1 = null) {}
function k($p0 = null, DateInterval $p1 = null) {}
function m($p0 = null, DateInterval $p1) {}
function n($p0 = null, $p1) {}
index b8b44ce..943e87c 100644
--- a/src/Phan/Language/Context.php
+++ b/src/Phan/Language/Context.php
@@ -289,7 +289,7 @@ class Context extends FileRef implements \Serializable
public function getClassInScope(CodeBase $code_base) : Clazz
{
assert($this->isInClassScope(),
- "Must be in class scope to get class");
+ "Must be in class scope to get class from $this");
diff --git a/src/Phan/Language/Context.php b/src/Phan/Language/Context.php
index b8b44ce..943e87c 100644
--- a/src/Phan/Language/Context.php
+++ b/src/Phan/Language/Context.php
@@ -289,7 +289,7 @@ class Context extends FileRef implements \Serializable
public function getClassInScope(CodeBase $code_base) : Clazz
{
assert($this->isInClassScope(),
- "Must be in class scope to get class");
+ "Must be in class scope to get class from $this");
diff --git a/src/Phan/Language/Context.php b/src/Phan/Language/Context.php
index b8b44ce..4e8c55c 100644
--- a/src/Phan/Language/Context.php
+++ b/src/Phan/Language/Context.php
@@ -289,7 +289,7 @@ class Context extends FileRef implements \Serializable
public function getClassInScope(CodeBase $code_base) : Clazz
{
assert($this->isInClassScope(),
- "Must be in class scope to get class");
+ "Must be in class scope to get class from $context");
src/Phan/Analysis/ArgumentVisitor.php
111: $property->addReference($this->context);
132: $method->addReference($this->context);
172: $method->addReference($this->context);
src/Phan/Analysis/PostOrderAnalysisVisitor.php
146: $method->addReference($this->context);
451: $constant->addReference($this->context);
484: $constant->addReference($this->context);
775: $class->addReference($this->context);
diff --git a/src/Phan/CLI.php b/src/Phan/CLI.php
index 2437e82..66ddd81 100644
--- a/src/Phan/CLI.php
+++ b/src/Phan/CLI.php
@@ -70,6 +70,7 @@ class CLI
'state-file:',
'processes:',
'signature-compatibility',
+ 'markdown-issue-messages',
]