-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
376 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Seferov\Typhp\Issue; | ||
|
||
class UntypedKnownArgumentIssue extends AbstractIssue | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $argumentName; | ||
/** | ||
* @var string | ||
*/ | ||
private $type; | ||
|
||
public static function create(string $name, int $line, string $argumentName, string $type): parent | ||
{ | ||
$issue = new self; | ||
$issue->name = $name; | ||
$issue->line = $line; | ||
$issue->argumentName = $argumentName; | ||
$issue->type = $type; | ||
|
||
return $issue; | ||
} | ||
|
||
public function getIssueCompact(): string | ||
{ | ||
return implode(';', [$this->getLine(), $this->getName(), 'untyped-known-argument', $this->argumentName]); | ||
} | ||
|
||
public function getIssue(): string | ||
{ | ||
return sprintf('Missing type declaration for argument "%s". Type must be "%s"', $this->argumentName, $this->type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Seferov\Typhp\Issue; | ||
|
||
class UntypedKnownReturnIssue extends AbstractIssue | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $type; | ||
|
||
public static function create(string $name, int $line, string $type): self | ||
{ | ||
$issue = new self; | ||
$issue->name = $name; | ||
$issue->line = $line; | ||
$issue->type = $type; | ||
|
||
return $issue; | ||
} | ||
|
||
public function getIssueCompact(): string | ||
{ | ||
return implode(';', [$this->getLine(), $this->getName(), 'untyped-known-return']); | ||
} | ||
|
||
public function getIssue(): string | ||
{ | ||
return sprintf('Missing return type. Type must be "%s"', $this->type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
tests/Functional/Scenarios/Fixtures/MagicMethodsNoIssue.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Seferov\Typhp\Tests\Functional\Scenarios\Fixtures; | ||
|
||
class MagicMethodsNoIssue | ||
{ | ||
public function __construct(string $name) {} | ||
|
||
public function __destruct() {} | ||
|
||
public function __call(string $name, array $arguments): string | ||
{ | ||
return $name; | ||
} | ||
|
||
public static function __callStatic(string $name, array $arguments): string | ||
{ | ||
return $name; | ||
} | ||
|
||
public function __get(string $name): bool | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* @param mixed $value | ||
*/ | ||
public function __set(string $name, $value): void {} | ||
|
||
public function __isset(string $name): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function __unset(string $name): void {} | ||
|
||
public function __sleep(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function __wakeup(): void {} | ||
|
||
public function __toString(): string | ||
{ | ||
return 'string'; | ||
} | ||
public function __invoke(bool $flag) { | ||
return 'invoked'; | ||
} | ||
public static function __set_state(array $properties) { | ||
return new self; | ||
} | ||
public function __clone() {} | ||
public function __debugInfo(): array | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.