Skip to content

Instantly share code, notes, and snippets.

View morria's full-sized avatar
✌️

Andrew Morrison morria

✌️
View GitHub Profile
<?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',
]
<?php
/**
* Memcached class.
*/
class Memcached {
/**
* Libmemcached behavior options.
*/
#!/usr/bin/env php
<?php declare(strict_types=1);
require_once(__DIR__.'/src/Phan/Bootstrap.php');
use \Phan\Issue;
$category = [];
foreach (Issue::issueMap() as $issue) {
$category[$issue->getCategoryName()][$issue->getType()] = [