Skip to content

Instantly share code, notes, and snippets.

View rvanvelzen's full-sized avatar

Richard van Velzen rvanvelzen

View GitHub Profile
diff --git a/src/PhpDoc/TypeNodeResolver.php b/src/PhpDoc/TypeNodeResolver.php
index e080c998e..b0215d092 100644
--- a/src/PhpDoc/TypeNodeResolver.php
+++ b/src/PhpDoc/TypeNodeResolver.php
@@ -83,6 +83,7 @@ use PHPStan\Type\MixedType;
use PHPStan\Type\NonAcceptingNeverType;
use PHPStan\Type\NonexistentParentClassType;
use PHPStan\Type\NullType;
+use PHPStan\Type\ObjectReferenceType;
use PHPStan\Type\ObjectShapeType;
diff --git a/src/Ast/PhpDoc/MethodTagValueNode.php b/src/Ast/PhpDoc/MethodTagValueNode.php
index 155897b..bc58511 100644
--- a/src/Ast/PhpDoc/MethodTagValueNode.php
+++ b/src/Ast/PhpDoc/MethodTagValueNode.php
@@ -26,13 +26,17 @@ class MethodTagValueNode implements PhpDocTagValueNode
/** @var string (may be empty) */
public $description;
- public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description)
+ /** @var bool */
@rvanvelzen
rvanvelzen / 502-seperate-var-statements.diff
Last active August 29, 2015 14:12
Patch for UglifyJS2#502
diff --git a/lib/output.js b/lib/output.js
index 7fe61af..c6752ae 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -890,17 +890,29 @@ function OutputStream(options) {
/* -----[ var/const ]----- */
AST_Definitions.DEFMETHOD("_do_print", function(output, kind){
- output.print(kind);
- output.space();
Uncaught Error: JX.$('UQ8_0') call matched no nodes. javelin.pkg.js:29
JX.$E javelin.pkg.js:29
JX.$ javelin.pkg.js:3000
(anonymous function) differential.pkg.js:1371
JX.initBehaviors javelin.pkg.js:1919
(anonymous function) javelin.pkg.js:2476
JX.install.statics._complete javelin.pkg.js:2078
diff --git a/ClassFinderVisitor.php b/ClassFinderVisitor.php
index 82a4792..29e85e2 100644
--- a/ClassFinderVisitor.php
+++ b/ClassFinderVisitor.php
@@ -55,22 +55,22 @@ class ClassFinderVisitor extends \PHPParser_NodeVisitorAbstract
|| $node instanceof \PHPParser_Node_Stmt_Interface
|| $node instanceof \PHPParser_Node_Stmt_Trait
) {
- $className = (string)$node->name;
+ $className = (string)$node->namespacedName;
(function() {
if (document.getElementById('flying-focus')) return;
var flyingFocus = document.createElement('flying-focus'); // use uniq element name to decrease the chances of a conflict with website styles
flyingFocus.id = 'flying-focus';
document.body.appendChild(flyingFocus);
var DURATION = 100;
flyingFocus.style.transitionDuration = flyingFocus.style.WebkitTransitionDuration = DURATION / 1000 + 's';
<?php
// Acorn was written by Marijn Haverbeke and released under an MIT
// license. The Unicode regexps (for identifiers and whitespace) were
// taken from [Esprima](http://esprima.org) by Ariya Hidayat.
//
// This port was done by Richard van Velzen
namespace JavaScript;
class Exception extends \Exception { }
@rvanvelzen
rvanvelzen / unindent.php
Created February 10, 2012 15:21
PHP unindent
<?php
/**
* Unindent a given string
*
* Empty lines are skipped.
*
* N.b.: de longest common substring is used, as a result all the
* indenting has to be exactly the same. Proper unindenting may fail
* otherwise.
*
@rvanvelzen
rvanvelzen / bench.php
Created January 25, 2012 14:41
Simple benchmark function for PHP >5.3
<?php
/**
* Very simplistic timing
*
* @param string $name Name of the current timing
* @param callback $what Function pointer to be executed
* @param int $times Number of times the function will be executed
*/
function bench($name, $what, $times = 1000) {
$start = microtime(true);