Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed checker for constructor-only classes. Closes #92.

  • Loading branch information...
commit 35b9307e25618ea14b017f810e2b75ee5c68b15e 1 parent c468f26
@ezzatron ezzatron authored
View
4 src/Eloquent/Typhoon/CodeAnalysis/ProjectAnalyzer.php
@@ -114,6 +114,8 @@ protected function analyzeClass(
->shorten($facadeClassName)
;
+ $hasCheckableMethods = false;
+ $hasConstructor = false;
$hasConstructorCall = false;
$propertyName = 'typeCheck';
foreach ($classDefinition->methods() as $methodDefinition) {
@@ -121,12 +123,12 @@ protected function analyzeClass(
continue;
}
+ $hasCheckableMethods = true;
list($hasConstructorCall, $propertyName) = $this->analyzeConstructor(
$methodDefinition,
$expectedfacadeClassName
);
}
- $hasCheckableMethods = false;
foreach ($classDefinition->methods() as $methodDefinition) {
if (
'__construct' === $methodDefinition->name() ||
View
23 test/src/Eloquent/Typhoon/TestFixture/AnalyzerFixtures/Failing/MissingConstructorCall.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+ * This file is part of the Typhoon package.
+ *
+ * Copyright © 2012 Erin Millard
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing;
+
+use Typhoon\TypeCheck;
+
+class MissingConstructorCall
+{
+ public function __construct()
+ {
+ }
+
+ private $typeCheck;
+}
View
2  ...re/AnalyzerFixtures/Failing/NoConstructorCall.php → ...ixture/AnalyzerFixtures/Failing/NoConstructor.php
@@ -11,7 +11,7 @@
namespace Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing;
-class NoConstructorCall
+class NoConstructor
{
public function foo()
{
View
3  test/suite/Eloquent/Typhoon/CodeAnalysis/ProjectAnalyzerTest.php
@@ -71,7 +71,8 @@ public function testAnalyzeFailures()
$this->assertFalse($actual->isSuccessful());
$this->assertSame(array(
- '\Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing\NoConstructorCall',
+ '\Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing\MissingConstructorCall',
+ '\Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing\NoConstructor',
), $actualClassesMissingConstructorCall);
$this->assertSame(array(
'\Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing\MissingProperty',
Please sign in to comment.
Something went wrong with that request. Please try again.