Repository: tightenco/tlint (php)

Issue:
PHP notice thrown when using tlint
I get the following notice repeatedly when using tlint:

```
PHP Notice:  Undefined property: PhpParser\Node\Expr\New_::$name in /Users/me/.composer/vendor/tightenco/tlint/src/Linters/RequestValidation.php on line 32
```

It doesn't hinder tlint from working but it doesn't look nice in the build-logs. :)

Pull request description:
Add instance of Variable check to RequestValidation linter.
Closes #129 

Patch:
diff --git a/src/Linters/RequestValidation.php b/src/Linters/RequestValidation.php
index 5f622dc..571fc67 100644
--- a/src/Linters/RequestValidation.php
+++ b/src/Linters/RequestValidation.php
@@ -28,7 +28,9 @@ class RequestValidation extends BaseLinter
             if (! $isController && $this->extends($node, 'Controller')) {
                 $isController = true;
             }
+
             return $node instanceof Node\Expr\MethodCall
+                && $node->var instanceof Node\Expr\Variable
                 && $node->var->name === 'this'
                 && $node->name->name === 'validate';
         });


Test patch:
diff --git a/tests/Linting/Linters/RequestValidationTest.php b/tests/Linting/Linters/RequestValidationTest.php
index 341823b..5691a9c 100644
--- a/tests/Linting/Linters/RequestValidationTest.php
+++ b/tests/Linting/Linters/RequestValidationTest.php
@@ -81,4 +81,29 @@ file;
 
         $this->assertEmpty($lints);
     }
+
+    /** @test */
+    function does_not_cause_php_notice_when_value_is_not_an_expression_with_a_name()
+    {
+        $file = <<<file
+<?php
+
+namespace App;
+
+class ControllerA extends Controller
+{
+    public function store()
+    {
+        return back()
+            ->with('errors', (new ViewErrorBag)->add('field', 'message'));
+    }
+}
+file;
+
+        $lints = (new TLint)->lint(
+            new RequestValidation($file)
+        );
+
+        $this->assertEmpty($lints);
+    }
 }