Skip to content

Commit

Permalink
Merge pull request #263 from sensiolabs-de/inferPrivatePropertyTypeFr…
Browse files Browse the repository at this point in the history
…omConstructor

phpstan - inferPrivatePropertyTypeFromConstructor
  • Loading branch information
Simon Mönch committed Sep 20, 2019
2 parents 9e85f7e + 168a097 commit 68e6027
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
parameters:
inferPrivatePropertyTypeFromConstructor: true
level: max
paths: [src]
4 changes: 4 additions & 0 deletions src/AstRunner/AstMap/AstClassReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ class AstClassReference
{
private $className;
private $fileReference;

/** @var AstDependency[] */
private $dependencies;

/** @var AstInherit[] */
private $inherits;

public function __construct(string $className, AstFileReference $fileReference = null)
Expand Down
4 changes: 4 additions & 0 deletions src/AstRunner/AstMap/AstFileReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
class AstFileReference
{
private $filepath;

/** @var AstClassReference[] */
private $astClassReferences;

/** @var AstDependency[] */
private $dependencies;

public function __construct(string $filepath)
Expand Down
2 changes: 2 additions & 0 deletions src/AstRunner/AstMap/AstInherit.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class AstInherit
private $className;
private $line;
private $type;

/** @var AstInherit[] */
private $path;

private function __construct(string $className, int $line, int $type)
Expand Down
1 change: 1 addition & 0 deletions src/AstRunner/AstParser/AstFileReferenceFileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

class AstFileReferenceFileCache implements AstFileReferenceCache
{
/** @var array<string, array> */
private $cache;
private $cacheFile;
private $loaded = false;
Expand Down
2 changes: 1 addition & 1 deletion src/AstRunner/AstParser/NikicPhpParser/FileParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(Parser $parser)
public function parse(\SplFileInfo $data): array
{
return (array) $this->parser->parse(
file_get_contents($data->getPathname())
(string) file_get_contents($data->getPathname())
);
}
}
8 changes: 6 additions & 2 deletions src/Configuration/ConfigurationRuleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@

class ConfigurationRuleset
{
private $layerMap = [];
/** @var array<string, string[]> */
private $layerMap;

/**
* @param array<string, string[]> $arr
*/
public static function fromArray(array $arr): self
{
return new static($arr);
}

/**
* @param string[] $layerMap
* @param array<string, string[]> $layerMap
*/
private function __construct(array $layerMap)
{
Expand Down
8 changes: 6 additions & 2 deletions src/Configuration/ConfigurationSkippedViolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
*/
class ConfigurationSkippedViolation
{
private $classesDeps = [];
/** @var array<string, string[]> */
private $classesDeps;

/**
* @param array<string, string[]> $arr
*/
public static function fromArray(array $arr): self
{
return new static($arr);
}

/**
* @param string[] $classesDeps
* @param array<string, string[]> $classesDeps
*/
private function __construct(array $classesDeps)
{
Expand Down

0 comments on commit 68e6027

Please sign in to comment.