Skip to content

Commit

Permalink
Generate baseline for proxy classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram Ceulemans committed Jan 18, 2022
1 parent beaad6c commit b90deae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
24 changes: 24 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ parameters:
count: 1
path: src/Faker/Extension/ContainerBuilder.php

-
message: "#^Method Faker\\\\Generator\\:\\:optional\\(\\) should return Faker\\\\Generator but returns Faker\\\\ChanceGenerator\\.$#"
count: 1
path: src/Faker/Generator.php

-
message: "#^Method Faker\\\\Generator\\:\\:unique\\(\\) should return Faker\\\\Generator but returns Faker\\\\UniqueGenerator\\.$#"
count: 1
path: src/Faker/Generator.php

-
message: "#^Method Faker\\\\Generator\\:\\:valid\\(\\) should return Faker\\\\Generator but returns Faker\\\\ValidGenerator\\.$#"
count: 1
path: src/Faker/Generator.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
Expand Down Expand Up @@ -735,6 +750,15 @@ parameters:
count: 2
path: src/Faker/Provider/Base.php

-
message:
"""
#^Instantiation of deprecated class Faker\\\\DefaultGenerator\\:
Use ChanceGenerator instead$#
"""
count: 1
path: src/Faker/Provider/Base.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
Expand Down
7 changes: 1 addition & 6 deletions psalm.baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.7.1@cd53e047a58f71f646dd6bf45476076ab07b5d44">
<files psalm-version="4.17.0@6f4707aa41c9174353a6434bba3fc8840f981d9c">
<file src="src/Faker/Calculator/Luhn.php">
<InvalidReturnStatement occurrences="1">
<code>0</code>
Expand All @@ -8,11 +8,6 @@
<code>string</code>
</InvalidReturnType>
</file>
<file src="src/Faker/Generator.php">
<InvalidThrow occurrences="1">
<code>ContainerExceptionInterface</code>
</InvalidThrow>
</file>
<file src="src/Faker/ORM/CakePHP/EntityPopulator.php">
<UndefinedClass occurrences="1">
<code>TableRegistry</code>
Expand Down
10 changes: 4 additions & 6 deletions src/Faker/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Faker;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;

/**
Expand Down Expand Up @@ -568,7 +567,6 @@ public function __construct(ContainerInterface $container = null)
*
* @param class-string<T> $id
*
* @throws ContainerExceptionInterface
* @throws Extension\ExtensionNotFound
*
* @return T
Expand Down Expand Up @@ -663,15 +661,15 @@ public function optional(float $weight = 0.5, $default = null)
* print_r($values); // [0, 4, 8, 4, 2, 6, 0, 8, 8, 6]
* </code>
*
* @param Closure $validator A function returning true for valid values
* @param int $maxRetries Maximum number of retries to find a valid value,
* After which an OverflowException is thrown.
* @param ?\Closure $validator A function returning true for valid values
* @param int $maxRetries Maximum number of retries to find a valid value,
* After which an OverflowException is thrown.
*
* @throws \OverflowException When no valid value can be found by iterating $maxRetries times
*
* @return self A proxy class returning only valid values
*/
public function valid(\Closure $validator = null, int $maxRetries = 10000)
public function valid(?\Closure $validator = null, int $maxRetries = 10000)
{
return new ValidGenerator($this, $validator, $maxRetries);
}
Expand Down

0 comments on commit b90deae

Please sign in to comment.