Skip to content
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ composer.lock
tests/Fixtures/Symfony/cache
tests/Fixtures/Symfony/logs
tests/Fixtures/Symfony/var
.phpunit.result.cache
.phpunit.cache
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"description": "PHP-PM adapter for Symfony HTTPKernel.",
"license": "MIT",
"require": {
"php": "^8.1|^8.2",
"php-pm/php-pm": "^2.0",
"symfony/http-foundation": "^4.2.12|^5.0.4|^6.0",
"symfony/http-kernel": "^4.0|^5.1.5|^6.0",
"guzzlehttp/psr7": "^1.5|^2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^9.5|^10.2",
"symfony/framework-bundle": "^4.1.12|^5.0|^6.0",
"symfony/yaml": "^4.0|^5.0|^6.0",
"doctrine/annotations": "^1.6"
Expand Down
14 changes: 6 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>

<testsuites>
<testsuite name="PHP-PM-HttpKernel Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>

</phpunit>
</phpunit>
54 changes: 8 additions & 46 deletions src/Laravel/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,22 @@

class SessionGuard extends \Illuminate\Auth\SessionGuard
{
protected Application $app;

/**
* App instance
*
* @var mixed|\Illuminate\Foundation\Application $app
*/
protected $app;

/**
* Create a new authentication guard.
*
* @param string $name
* @param \Illuminate\Contracts\Auth\UserProvider $provider
* @param \Illuminate\Contracts\Session\Session $session
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Illuminate\Foundation\Application $app
* @return void
*/
public function __construct(
$name,
public readonly string $name,
UserProvider $provider,
Session $session,
Request $request = null,
Application $app
) {
$this->name = $name;
$this->session = $session;
$this->request = $request;
$this->provider = $provider;
$this->app = $app;
}

/**
* Set the current request instance.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return $this
*/
public function setRequest(Request $request)
public function setRequest(Request $request): self
{
// reset the current state
$this->reset();
Expand All @@ -57,33 +34,18 @@ public function setRequest(Request $request)

return parent::setRequest($request);
}

/**
* Get a unique identifier for the auth session value.
*
* @return string
*/
public function getName()

public function getName(): string
{
return 'login_'.$this->name.'_'.sha1(parent::class);
}

/**
* Get the name of the cookie used to store the "recaller".
*
* @return string
*/
public function getRecallerName()
public function getRecallerName(): string
{
return 'remember_'.$this->name.'_'.sha1(parent::class);
}

/**
* Reset the state of current class instance.
*
* @return void
*/
protected function reset()

protected function reset(): void
{
$this->user = null;
$this->lastAttempted = null;
Expand Down