Skip to content

Commit

Permalink
Ensure the codebase is totally typed
Browse files Browse the repository at this point in the history
This implies bumping doctrine/orm to ^3, because one of the type
declarations in ORMPurger references a class that only exists in that
version.
  • Loading branch information
greg0ire committed Nov 4, 2024
1 parent 7a0cc32 commit ed4fffa
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
10 changes: 2 additions & 8 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,12 @@
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint">
<!-- Adding parameter types is a BC break in most cases because of strict types. -->
<exclude-pattern>src/*</exclude-pattern>

<!-- ORM 3 compatibility -->
<exclude-pattern>src/Purger/ORMPurger.php</exclude-pattern>
<!-- Don't add parameter types to overridden methods -->
<exclude-pattern>tests/Common/DataFixtures/TestTypes/UuidType.php</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint">
<!-- Adding property types is a BC break in most cases. -->
<exclude-pattern>src/*</exclude-pattern>
</rule>

<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
Expand Down
4 changes: 1 addition & 3 deletions src/AbstractFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ abstract class AbstractFixture implements SharedFixtureInterface
{
/**
* Fixture reference repository
*
* @var ReferenceRepository|null
*/
protected $referenceRepository;
protected ReferenceRepository|null $referenceRepository = null;

public function setReferenceRepository(ReferenceRepository $referenceRepository): void
{
Expand Down
8 changes: 2 additions & 6 deletions src/Executor/AbstractExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ abstract class AbstractExecutor implements LoggerAwareInterface

/**
* Purger instance for purging database before loading data fixtures
*
* @var PurgerInterface|null
*/
protected $purger;
protected PurgerInterface|null $purger = null;

/**
* Fixture reference repository
*
* @var ReferenceRepository
*/
protected $referenceRepository;
protected ReferenceRepository $referenceRepository;

public function __construct(ObjectManager $manager)
{
Expand Down
4 changes: 1 addition & 3 deletions src/Purger/ORMPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ class ORMPurger implements PurgerInterface, ORMPurgerInterface

/**
* If the purge should be done through DELETE or TRUNCATE statements
*
* @var int
*/
private $purgeMode = self::PURGE_MODE_DELETE;
private int $purgeMode = self::PURGE_MODE_DELETE;

/**
* Table/view names to be excluded from purge
Expand Down
3 changes: 1 addition & 2 deletions src/ReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ public function setReference(string $name, object $reference): void
/**
* Store the identifier of a reference
*
* @param mixed $identity
* @param class-string $class
*/
public function setReferenceIdentity(string $name, $identity, string $class): void
public function setReferenceIdentity(string $name, mixed $identity, string $class): void
{
$this->identitiesByClass[$class][$name] = $identity;
}
Expand Down

0 comments on commit ed4fffa

Please sign in to comment.