FactoryCountResetTypeSpecifyingExtension
class FactoryCountResetTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
Clear a factory's count after createMany(), createManyQuietly() or makeMany(), which clear it at runtime.
PHPStan applies this to a call used as a statement or an assigned value. A @phpstan-self-out tag would cover every call, but PHPStan stores a self-out type even for a receiver such as User::factory(), so later calls to User::factory() would lose their count too.
Methods
Get the class the extension applies to.
Determine whether the call is a statement-level call of a base method that clears the count.
Mark the receiving factory as making a single model.
Set the type specifier used to narrow the factory.
Details
at line 38
string
getClass()
Get the class the extension applies to.
at line 46
bool
isMethodSupported(MethodReflection $methodReflection, MethodCall $node, TypeSpecifierContext $context)
Determine whether the call is a statement-level call of a base method that clears the count.
at line 59
SpecifiedTypes
specifyTypes(MethodReflection $methodReflection, MethodCall $node, Scope $scope, TypeSpecifierContext $context)
Mark the receiving factory as making a single model.
at line 83
void
setTypeSpecifier(TypeSpecifier $typeSpecifier)
Set the type specifier used to narrow the factory.