This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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

  • Loading branch information...
1 parent c468f26 commit 35b9307e25618ea14b017f810e2b75ee5c68b15e @ezzatron ezzatron committed Jan 22, 2013
@@ -114,19 +114,21 @@ protected function analyzeClass(
->shorten($facadeClassName)
;
+ $hasCheckableMethods = false;
+ $hasConstructor = false;
$hasConstructorCall = false;
$propertyName = 'typeCheck';
foreach ($classDefinition->methods() as $methodDefinition) {
if ('__construct' !== $methodDefinition->name()) {
continue;
}
+ $hasCheckableMethods = true;
list($hasConstructorCall, $propertyName) = $this->analyzeConstructor(
$methodDefinition,
$expectedfacadeClassName
);
}
- $hasCheckableMethods = false;
foreach ($classDefinition->methods() as $methodDefinition) {
if (
'__construct' === $methodDefinition->name() ||
@@ -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;
+}
@@ -11,7 +11,7 @@
namespace Eloquent\Typhoon\TestFixture\AnalyzerFixtures\Failing;
-class NoConstructorCall
+class NoConstructor
{
public function foo()
{
@@ -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',

0 comments on commit 35b9307

Please sign in to comment.