Skip to content

Commit

Permalink
fixed conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: alexmerlin <[email protected]>
  • Loading branch information
alexmerlin committed Dec 16, 2024
2 parents ef0be24 + 1bf14e6 commit 2fc7a92
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 139 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ jobs:
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Setup project
run: |
mv config/autoload/local.php.dist config/autoload/local.php
mv config/autoload/mail.local.php.dist config/autoload/mail.local.php
mv config/autoload/local.test.php.dist config/autoload/local.test.php
- name: Collect code coverage with PHPUnit
run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
contents: write
pull-requests: write
checks: write
strategy:
matrix:
php-versions: [ '8.2', '8.3' ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -22,7 +25,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
php-version: ${{ matrix.php-versions }}
coverage: pcov
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
tools: composer:v2, cs2pr
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,5 @@ jobs:
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Setup project
run: |
mv config/autoload/local.php.dist config/autoload/local.php
mv config/autoload/mail.local.php.dist config/autoload/mail.local.php
mv config/autoload/local.test.php.dist config/autoload/local.test.php
- name: Run static analysis with PHPStan
run: vendor/bin/phpstan analyse
35 changes: 35 additions & 0 deletions bin/composer-post-install-script.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols

function copyFile(array $file): void
{
if (is_readable($file['destination'])) {
echo "File {$file['destination']} already exists." . PHP_EOL;
} else {
if (! copy($file['source'], $file['destination'])) {
echo "Cannot copy {$file['source']} file to {$file['destination']}" . PHP_EOL;
} else {
echo "File {$file['source']} copied successfully to {$file['destination']}." . PHP_EOL;
}
}
}

$files = [
[
'source' => 'config/autoload/local.php.dist',
'destination' => 'config/autoload/local.php',
],
[
'source' => 'config/autoload/local.test.php.dist',
'destination' => 'config/autoload/local.test.php',
],
[
'source' => 'vendor/dotkernel/dot-mail/config/mail.global.php.dist',
'destination' => 'config/autoload/mail.global.php',
],
];

array_walk($files, 'copyFile');
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dotkernel/dot-flashmessenger": "^3.4.2",
"dotkernel/dot-geoip": "^3.6.0",
"dotkernel/dot-helpers": "^3.4.2",
"dotkernel/dot-mail": "^4.1.1",
"dotkernel/dot-mail": "^5.1.0",
"dotkernel/dot-navigation": "^3.4.2",
"dotkernel/dot-rbac-guard": "^3.4.2",
"dotkernel/dot-session": "^5.6.0",
Expand All @@ -57,9 +57,8 @@
},
"require-dev": {
"filp/whoops": "^2.15.4",
"laminas/laminas-coding-standard": "^2.5.0",
"laminas/laminas-coding-standard": "^3.0",
"laminas/laminas-development-mode": "^3.12.0",
"laminas/laminas-http": "^2.19.0",
"mezzio/mezzio-tooling": "^2.9.0",
"phpunit/phpunit": "^10.5.9",
"roave/security-advisories": "dev-latest",
Expand Down Expand Up @@ -88,6 +87,9 @@
"post-create-project-cmd": [
"@development-enable"
],
"post-update-cmd": [
"php bin/composer-post-install-script.php"
],
"development-disable": "laminas-development-mode disable",
"development-enable": "laminas-development-mode enable",
"development-status": "laminas-development-mode status",
Expand All @@ -101,7 +103,7 @@
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8080 -t public/",
"static-analysis": "phpstan analyse",
"static-analysis": "phpstan analyse --memory-limit 1G",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"twig-cs-check": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php",
Expand Down
1 change: 0 additions & 1 deletion config/autoload/authentication.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'identity_class' => Admin::class,
'identity_property' => 'identity',
'credential_property' => 'password',
'credential_callable' => 'Admin\Admin\Doctrine\AdminAuthentication::verifyCredential',
'messages' => [
'success' => 'Authenticated successfully.',
'not_found' => 'Identity not found.',
Expand Down
8 changes: 4 additions & 4 deletions config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ $databases = [
];

return [
'application' => [
'application' => [
'name' => $app['name'] ?? '',
'url' => $baseUrl,
],
'databases' => $databases,
'doctrine' => [
'connection' => [
'databases' => $databases,
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => $databases['default'],
],
Expand Down
92 changes: 0 additions & 92 deletions config/autoload/mail.local.php.dist

This file was deleted.

5 changes: 4 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
<file>test</file>

<!-- Include all rules from the Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>
<rule ref="LaminasCodingStandard">
<!-- Exclude rule -->
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" />
</rule>
</ruleset>
3 changes: 3 additions & 0 deletions src/Admin/src/Adapter/AuthenticationAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Admin\Admin\Entity\AdminIdentity;
use Admin\Admin\Entity\AdminRole;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Exception\ORMException;
use Dot\DependencyInjection\Attribute\Inject;
use Exception;
use Laminas\Authentication\Adapter\AdapterInterface;
Expand Down Expand Up @@ -64,6 +65,7 @@ private function getCredential(): string

/**
* @throws Exception
* @throws ORMException
*/
public function authenticate(): Result
{
Expand All @@ -85,6 +87,7 @@ public function authenticate(): Result
[$this->config['orm_default']['messages']['not_found']]
);
}
$this->entityManager->refresh($identityClass);

$getCredential = "get" . ucfirst($this->config['orm_default']['credential_property']);

Expand Down
4 changes: 0 additions & 4 deletions src/Admin/src/Entity/AdminIdentity.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ public function getStatus(): AdminStatusEnum
return $this->status;
}

/**
* @return iterable
*/
public function getRoles(): iterable
{
return $this->roles;
}

/**
* @return array
* @psalm-return array<string, mixed>
*/
public function getDetails(): array
Expand Down
3 changes: 0 additions & 3 deletions src/Admin/src/Form/AdminForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function __construct(?string $name = null, array $options = [])
$this->inputFilter->init();
}

/**
* @param array $roles
*/
public function setRoles(array $roles): void
{
$this->roles = $roles;
Expand Down
6 changes: 0 additions & 6 deletions src/Admin/src/FormData/AdminFormData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ class AdminFormData
public ?string $status = null;
public array $roles = [];

/**
* @return array
*/
public function getRoles(): array
{
return $this->roles;
Expand All @@ -35,9 +32,6 @@ public function fromEntity(Admin $admin): self
return $this;
}

/**
* @return array
*/
public function getArrayCopy(): array
{
return [
Expand Down
8 changes: 4 additions & 4 deletions src/Admin/src/Service/AdminService.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ public function logAdminVisit(array $serverParams, string $name, SuccessFailureE

$ipAddress = IpService::getUserIp($serverParams);

$country = (string) $this->locationService->getCountry($ipAddress)->getName();
$continent = (string) $this->locationService->getContinent($ipAddress)->getName();
$organization = (string) $this->locationService->getOrganization($ipAddress)->getName();
$country = $this->locationService->getCountry($ipAddress)->getName();
$continent = $this->locationService->getContinent($ipAddress)->getName();
$organization = $this->locationService->getOrganization($ipAddress)->getName();

$adminLogin = (new AdminLogin())
->setAdminIp($ipAddress)
->setAdminIp($this->locationService->obfuscateIpAddress($ipAddress))
->setContinent($continent)
->setCountry($country)
->setOrganization($organization)
Expand Down
4 changes: 0 additions & 4 deletions src/App/src/Plugin/FormsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ private function formMessagesToString(array $formMessages): string
return $messages;
}

/**
* @param array $formMessages
* @return array
*/
protected function processFormMessages(array $formMessages): array
{
$messages = [];
Expand Down
6 changes: 3 additions & 3 deletions test/Unit/App/Middleware/AuthMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Dot\Rbac\Guard\Guard\GuardInterface;
use Dot\Rbac\Guard\Options\RbacGuardOptions;
use Dot\Rbac\Guard\Provider\GuardsProviderInterface;
use Fig\Http\Message\StatusCodeInterface;
use Laminas\Diactoros\Response\RedirectResponse;
use Laminas\Http\Response;
use Mezzio\Router\RouterInterface;
use PHPUnit\Framework\MockObject\Exception;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -58,7 +58,7 @@ public function testWillRedirectWhenNotGranted(): void
);
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertTrue($response->hasHeader('location'));
$this->assertEquals(Response::STATUS_CODE_302, $response->getStatusCode());
$this->assertEquals(StatusCodeInterface::STATUS_FOUND, $response->getStatusCode());
}

/**
Expand Down Expand Up @@ -144,7 +144,7 @@ public function getPriority(): int
);
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertTrue($response->hasHeader('location'));
$this->assertEquals(Response::STATUS_CODE_302, $response->getStatusCode());
$this->assertEquals(StatusCodeInterface::STATUS_FOUND, $response->getStatusCode());
}

/**
Expand Down

0 comments on commit 2fc7a92

Please sign in to comment.