|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Database\Factories\Squareetlabs\VeriFactu\Models; |
|
6
|
|
|
|
|
7
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory; |
|
8
|
|
|
use Squareetlabs\VeriFactu\Models\Breakdown; |
|
9
|
|
|
use Squareetlabs\VeriFactu\Enums\TaxType; |
|
10
|
|
|
use Squareetlabs\VeriFactu\Enums\RegimeType; |
|
11
|
|
|
use Squareetlabs\VeriFactu\Enums\OperationType; |
|
12
|
|
|
|
|
13
|
|
|
class BreakdownFactory extends Factory |
|
14
|
|
|
{ |
|
15
|
|
|
protected $model = Breakdown::class; |
|
16
|
|
|
|
|
17
|
|
|
public function definition(): array |
|
18
|
|
|
{ |
|
19
|
|
|
return [ |
|
20
|
|
|
'tax_type' => $this->faker->randomElement(array_column(TaxType::cases(), 'value')), |
|
|
|
|
|
|
21
|
|
|
'regime_type' => $this->faker->randomElement(array_column(RegimeType::cases(), 'value')), |
|
22
|
|
|
'operation_type' => $this->faker->randomElement(array_column(OperationType::cases(), 'value')), |
|
23
|
|
|
'tax_rate' => $this->faker->randomFloat(2, 0, 21), |
|
24
|
|
|
'base_amount' => $this->faker->randomFloat(2, 100, 1000), |
|
25
|
|
|
'tax_amount' => $this->faker->randomFloat(2, 10, 200), |
|
26
|
|
|
'equivalence_surcharge_rate' => $this->faker->optional()->randomFloat(2, 0, 5), |
|
27
|
|
|
'equivalence_surcharge_amount' => $this->faker->optional()->randomFloat(2, 0, 50), |
|
28
|
|
|
'exemption_code' => $this->faker->optional()->bothify('E#'), |
|
29
|
|
|
'exemption_description' => $this->faker->optional()->sentence, |
|
30
|
|
|
]; |
|
31
|
|
|
} |
|
32
|
|
|
} |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.