Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Symfony 7 #274

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"require": {
"php": ">=7.2.5",
"ext-json": "*",
"symfony/config": "^5.4 | ^6.0",
"symfony/dependency-injection": "^5.4 | ^6.0",
"symfony/config": "^5.4 | ^6.0 | ^7.0",
"symfony/dependency-injection": "^5.4 | ^6.0 | ^7.0",
"symfony/deprecation-contracts": "^2.2 | ^3.0",
"symfony/http-kernel": "^5.4 | ^6.0"
"symfony/http-kernel": "^5.4 | ^6.0 | ^7.0"
},
"require-dev": {
"doctrine/orm": "^2.7",
"symfony/framework-bundle": "^5.4 | ^6.0",
"symfony/phpunit-bridge": "^5.4 | ^6.0",
"symfony/framework-bundle": "^5.4 | ^6.0 | ^7.0",
"symfony/phpunit-bridge": "^5.4 | ^6.0 | ^7.0",
"doctrine/doctrine-bundle": "^2.0.3",
"doctrine/annotations": "^1.0"
},
Expand Down
26 changes: 4 additions & 22 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,12 @@
<RawObjectIteration errorLevel="info"/>

<InvalidStringClass errorLevel="info"/>
<PossiblyUndefinedMethod>
<errorLevel type="suppress">
<file name="src/DependencyInjection/Configuration.php"/>
</errorLevel>
</PossiblyUndefinedMethod>
<PossiblyNullReference>

<UndefinedInterfaceMethod>
<errorLevel type="suppress">
<file name="src/DependencyInjection/Configuration.php"/>
<referencedMethod name="Symfony\Component\Config\Definition\Builder\NodeParentInterface::integerNode" />
</errorLevel>
</PossiblyNullReference>
<PossiblyNullArgument>
<errorLevel type="suppress">
<file name="src/DependencyInjection/SymfonyCastsResetPasswordExtension.php"/>
</errorLevel>
</PossiblyNullArgument>
<InvalidReturnType>
<errorLevel type="suppress">
<file name="src/Persistence/Fake/FakeResetPasswordInternalRepository.php"/>
</errorLevel>
</InvalidReturnType>
<TooManyArguments>
<errorLevel type="suppress">
<file name="src/Model/ResetPasswordToken.php"/>
</errorLevel>
</TooManyArguments>
</UndefinedInterfaceMethod>
</issueHandlers>
</psalm>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function load(array $configs, ContainerBuilder $container): void
$loader->load('reset_password_services.xml');

$configuration = $this->getConfiguration($configs, $container);
if (!$configuration) {
throw new \Exception('Configuration is not expected to be null');
}

$config = $this->processConfiguration($configuration, $configs);

Expand Down
3 changes: 3 additions & 0 deletions src/Model/ResetPasswordToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public function getExpiresAtIntervalInstance(): \DateInterval
return $this->expiresAt->diff($createdAtTime);
}

/**
* @psalm-suppress UndefinedFunction
*/
private function triggerDeprecation(): void
{
trigger_deprecation(
Expand Down
8 changes: 8 additions & 0 deletions tests/Fixtures/Entity/ResetPasswordTestFixtureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
* @ORM\Entity(repositoryClass="SymfonyCasts\Bundle\ResetPassword\Tests\Fixtures\ResetPasswordTestFixtureRequestRepository")
*/
#[ORM\Entity(repositoryClass: "SymfonyCasts\Bundle\ResetPassword\Tests\Fixtures\ResetPasswordTestFixtureRequestRepository")]
final class ResetPasswordTestFixtureRequest implements ResetPasswordRequestInterface
{
/**
Expand All @@ -29,26 +30,33 @@ final class ResetPasswordTestFixtureRequest implements ResetPasswordRequestInter
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
public $id;

/**
* @ORM\Column(type="string", nullable=true)
*/
#[ORM\Column(type: 'string', nullable: true)]
public $selector;

/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
public $expiresAt;

/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
public $requestedAt;

/**
* @ORM\ManyToOne(targetEntity="ResetPasswordTestFixtureUser")
*/
#[ORM\ManyToOne(targetEntity: 'ResetPasswordTestFixtureUser')]
public $user;

public function getRequestedAt(): \DateTimeInterface
Expand Down
4 changes: 4 additions & 0 deletions tests/Fixtures/Entity/ResetPasswordTestFixtureUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
* @ORM\Entity()
*/
#[ORM\Entity]
final class ResetPasswordTestFixtureUser
{
/**
Expand All @@ -28,5 +29,8 @@ final class ResetPasswordTestFixtureUser
*
* @ORM\Column(type="integer")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
}
7 changes: 6 additions & 1 deletion tests/ResetPasswordTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
'mappings' => [
'App' => [
'is_bundle' => false,
'type' => 'annotation',
'type' => self::shouldUseAttributes() ? 'attribute' : 'annotation',
'dir' => 'tests/Fixtures/Entity/',
'prefix' => 'SymfonyCasts\Bundle\ResetPassword\Tests\Fixtures\Entity',
'alias' => 'App',
Expand Down Expand Up @@ -141,4 +141,9 @@ public function getLogDir(): string
{
return sys_get_temp_dir().'/logs'.spl_object_hash($this);
}

public static function shouldUseAttributes(): bool
{
return Kernel::VERSION_ID >= 70000;
}
}
Loading