From a8f320249e01e854c660167a16f266acf6a40484 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 15 Jan 2024 13:20:03 +0100 Subject: [PATCH] Rename App namespace to Surfnet/Tiqr --- bin/console | 2 +- ci/qa/phpstan-baseline.neon | 60 +++++++++---------- composer.json | 9 +-- config/packages/twig.yaml | 2 +- config/services.yaml | 20 +++---- config/services_dev.yaml | 6 +- config/services_test.yaml | 6 +- dev/Command/AuthenticationCommand.php | 2 +- dev/Command/RegistrationCommand.php | 2 +- dev/Controller/QrLinkController.php | 8 +-- dev/Controller/SPController.php | 10 ++-- dev/FileLogger.php | 2 +- dev/HttpClientFactory.php | 2 +- dev/Twig/GsspExtension.php | 2 +- public/index.php | 2 +- src/Controller/AuthenticationController.php | 28 ++++----- src/Controller/CancelController.php | 6 +- src/Controller/ExceptionController.php | 12 ++-- src/Controller/InfoController.php | 4 +- src/Controller/RegistrationController.php | 6 +- src/Controller/TiqrAppApiController.php | 16 ++--- src/DependencyInjection/Configuration.php | 2 +- .../LocaleResponseListener.php | 2 +- .../NoActiveAuthenrequestException.php | 2 +- src/Exception/TiqrServerRuntimeException.php | 2 +- src/Exception/UserNotFoundException.php | 2 +- .../UserPermanentlyBlockedException.php | 2 +- .../UserTemporarilyBlockedException.php | 2 +- src/Features/Context/ErrorReportContext.php | 2 +- src/Features/Context/TiqrContext.php | 15 +++-- src/Features/Context/WebContext.php | 2 +- src/Kernel.php | 2 +- src/Service/ErrorPageHelper.php | 2 +- src/Service/GlobalViewParameters.php | 2 +- src/Service/UserAgentMatcher.php | 2 +- src/Service/UserAgentMatcherInterface.php | 2 +- src/Tiqr/AuthenticationRateLimitService.php | 18 +++--- ...uthenticationRateLimitServiceInterface.php | 4 +- src/Tiqr/Exception/ConfigurationException.php | 2 +- src/Tiqr/Exception/UserNotExistsException.php | 2 +- src/Tiqr/Legacy/TiqrService.php | 18 +++--- src/Tiqr/Legacy/TiqrUser.php | 8 +-- src/Tiqr/Legacy/TiqrUserRepository.php | 8 +-- .../Response/AuthenticationErrorResponse.php | 2 +- src/Tiqr/Response/AuthenticationResponse.php | 2 +- ...rmanentlyBlockedAuthenticationResponse.php | 2 +- .../RateLimitedAuthenticationResponse.php | 2 +- .../RejectedAuthenticationResponse.php | 2 +- ...mporarilyBlockedAuthenticationResponse.php | 2 +- .../Response/ValidAuthenticationResponse.php | 2 +- src/Tiqr/TiqrConfiguration.php | 6 +- src/Tiqr/TiqrConfigurationInterface.php | 4 +- src/Tiqr/TiqrFactory.php | 6 +- src/Tiqr/TiqrServiceInterface.php | 6 +- src/Tiqr/TiqrUserInterface.php | 4 +- src/Tiqr/TiqrUserRepositoryInterface.php | 7 +-- src/WithContextLogger.php | 2 +- 57 files changed, 175 insertions(+), 184 deletions(-) diff --git a/bin/console b/bin/console index 3b25858d..4b4b228a 100755 --- a/bin/console +++ b/bin/console @@ -1,6 +1,6 @@ #!/usr/bin/env php , array\\ given\\.$#" + message: "#^Parameter \\#2 \\$context of static method Surfnet\\\\Tiqr\\\\WithContextLogger\\:\\:from\\(\\) expects array\\, array\\ given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Parameter \\#2 \\$notificationType of method App\\\\Controller\\\\TiqrAppApiController\\:\\:loginAction\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$notificationType of method Surfnet\\\\Tiqr\\\\Controller\\\\TiqrAppApiController\\:\\:loginAction\\(\\) expects string, mixed given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Parameter \\#2 \\$secret of method App\\\\Tiqr\\\\TiqrUserRepositoryInterface\\:\\:createUser\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$secret of method Surfnet\\\\Tiqr\\\\Tiqr\\\\TiqrUserRepositoryInterface\\:\\:createUser\\(\\) expects string, mixed given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php @@ -66,17 +66,17 @@ parameters: path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Parameter \\#3 \\$notificationAddress of method App\\\\Controller\\\\TiqrAppApiController\\:\\:loginAction\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#3 \\$notificationAddress of method Surfnet\\\\Tiqr\\\\Controller\\\\TiqrAppApiController\\:\\:loginAction\\(\\) expects string, mixed given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Parameter \\#3 \\$notificationType of method App\\\\Controller\\\\TiqrAppApiController\\:\\:registerAction\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#3 \\$notificationType of method Surfnet\\\\Tiqr\\\\Controller\\\\TiqrAppApiController\\:\\:registerAction\\(\\) expects string, mixed given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Parameter \\#3 \\$response of method App\\\\Tiqr\\\\AuthenticationRateLimitServiceInterface\\:\\:authenticate\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#3 \\$response of method Surfnet\\\\Tiqr\\\\Tiqr\\\\AuthenticationRateLimitServiceInterface\\:\\:authenticate\\(\\) expects string, mixed given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php @@ -86,27 +86,27 @@ parameters: path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Parameter \\#4 \\$notificationAddress of method App\\\\Controller\\\\TiqrAppApiController\\:\\:registerAction\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#4 \\$notificationAddress of method Surfnet\\\\Tiqr\\\\Controller\\\\TiqrAppApiController\\:\\:registerAction\\(\\) expects string, mixed given\\.$#" count: 1 path: ../../src/Controller/TiqrAppApiController.php - - message: "#^Method App\\\\DependencyInjection\\\\Configuration\\:\\:createBlockingConfig\\(\\) has no return type specified\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\DependencyInjection\\\\Configuration\\:\\:createBlockingConfig\\(\\) has no return type specified\\.$#" count: 1 path: ../../src/DependencyInjection/Configuration.php - - message: "#^Method App\\\\DependencyInjection\\\\Configuration\\:\\:createGeneralConfig\\(\\) has no return type specified\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\DependencyInjection\\\\Configuration\\:\\:createGeneralConfig\\(\\) has no return type specified\\.$#" count: 1 path: ../../src/DependencyInjection/Configuration.php - - message: "#^Method App\\\\DependencyInjection\\\\Configuration\\:\\:createLibraryConfig\\(\\) has no return type specified\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\DependencyInjection\\\\Configuration\\:\\:createLibraryConfig\\(\\) has no return type specified\\.$#" count: 1 path: ../../src/DependencyInjection/Configuration.php - - message: "#^Method App\\\\DependencyInjection\\\\Configuration\\:\\:createStorageConfig\\(\\) has no return type specified\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\DependencyInjection\\\\Configuration\\:\\:createStorageConfig\\(\\) has no return type specified\\.$#" count: 1 path: ../../src/DependencyInjection/Configuration.php @@ -186,7 +186,7 @@ parameters: path: ../../src/Features/Context/TiqrContext.php - - message: "#^Parameter \\#1 \\$src of method App\\\\Features\\\\Context\\\\TiqrContext\\:\\:getFileContentsInsecure\\(\\) expects string, string\\|null given\\.$#" + message: "#^Parameter \\#1 \\$src of method Surfnet\\\\Tiqr\\\\Features\\\\Context\\\\TiqrContext\\:\\:getFileContentsInsecure\\(\\) expects string, string\\|null given\\.$#" count: 2 path: ../../src/Features/Context/TiqrContext.php @@ -206,7 +206,7 @@ parameters: path: ../../src/Features/Context/TiqrContext.php - - message: "#^Property App\\\\Features\\\\Context\\\\TiqrContext\\:\\:\\$metadata \\(stdClass\\) does not accept mixed\\.$#" + message: "#^Property Surfnet\\\\Tiqr\\\\Features\\\\Context\\\\TiqrContext\\:\\:\\$metadata \\(stdClass\\) does not accept mixed\\.$#" count: 1 path: ../../src/Features/Context/TiqrContext.php @@ -216,12 +216,12 @@ parameters: path: ../../src/Features/Context/WebContext.php - - message: "#^Parameter \\#1 \\$key of method App\\\\Features\\\\Context\\\\WebContext\\:\\:loadPrivateKey\\(\\) expects SAML2\\\\Configuration\\\\PrivateKey, mixed given\\.$#" + message: "#^Parameter \\#1 \\$key of method Surfnet\\\\Tiqr\\\\Features\\\\Context\\\\WebContext\\:\\:loadPrivateKey\\(\\) expects SAML2\\\\Configuration\\\\PrivateKey, mixed given\\.$#" count: 1 path: ../../src/Features/Context/WebContext.php - - message: "#^Property App\\\\Features\\\\Context\\\\WebContext\\:\\:\\$previousMinkSession \\(string\\) does not accept string\\|null\\.$#" + message: "#^Property Surfnet\\\\Tiqr\\\\Features\\\\Context\\\\WebContext\\:\\:\\$previousMinkSession \\(string\\) does not accept string\\|null\\.$#" count: 1 path: ../../src/Features/Context/WebContext.php @@ -241,12 +241,12 @@ parameters: path: ../../src/Tiqr/Legacy/TiqrService.php - - message: "#^Method App\\\\Tiqr\\\\Legacy\\\\TiqrService\\:\\:getAuthenticationSessionKey\\(\\) should return string but returns mixed\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\Tiqr\\\\Legacy\\\\TiqrService\\:\\:getAuthenticationSessionKey\\(\\) should return string but returns mixed\\.$#" count: 1 path: ../../src/Tiqr/Legacy/TiqrService.php - - message: "#^Method App\\\\Tiqr\\\\Legacy\\\\TiqrService\\:\\:getUserId\\(\\) should return string but returns mixed\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\Tiqr\\\\Legacy\\\\TiqrService\\:\\:getUserId\\(\\) should return string but returns mixed\\.$#" count: 1 path: ../../src/Tiqr/Legacy/TiqrService.php @@ -286,22 +286,22 @@ parameters: path: ../../src/Tiqr/TiqrConfiguration.php - - message: "#^Method App\\\\Tiqr\\\\TiqrConfiguration\\:\\:getMaxAttempts\\(\\) should return int but returns mixed\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\Tiqr\\\\TiqrConfiguration\\:\\:getMaxAttempts\\(\\) should return int but returns mixed\\.$#" count: 1 path: ../../src/Tiqr/TiqrConfiguration.php - - message: "#^Method App\\\\Tiqr\\\\TiqrConfiguration\\:\\:getMaxTemporarilyLoginAttempts\\(\\) should return int but returns mixed\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\Tiqr\\\\TiqrConfiguration\\:\\:getMaxTemporarilyLoginAttempts\\(\\) should return int but returns mixed\\.$#" count: 1 path: ../../src/Tiqr/TiqrConfiguration.php - - message: "#^Method App\\\\Tiqr\\\\TiqrConfiguration\\:\\:getTemporarilyBlockDuration\\(\\) should return int but returns mixed\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\Tiqr\\\\TiqrConfiguration\\:\\:getTemporarilyBlockDuration\\(\\) should return int but returns mixed\\.$#" count: 1 path: ../../src/Tiqr/TiqrConfiguration.php - - message: "#^Method App\\\\Tiqr\\\\TiqrConfiguration\\:\\:getTiqrOptions\\(\\) should return array\\\\> but returns array\\\\.$#" + message: "#^Method Surfnet\\\\Tiqr\\\\Tiqr\\\\TiqrConfiguration\\:\\:getTiqrOptions\\(\\) should return array\\\\> but returns array\\\\.$#" count: 1 path: ../../src/Tiqr/TiqrConfiguration.php @@ -341,6 +341,6 @@ parameters: path: ../../src/Tiqr/TiqrFactory.php - - message: "#^Parameter \\#6 \\$accountName of class App\\\\Tiqr\\\\Legacy\\\\TiqrService constructor expects string, mixed given\\.$#" + message: "#^Parameter \\#6 \\$accountName of class Surfnet\\\\Tiqr\\\\Tiqr\\\\Legacy\\\\TiqrService constructor expects string, mixed given\\.$#" count: 1 path: ../../src/Tiqr/TiqrFactory.php diff --git a/composer.json b/composer.json index d5d5fb0a..655a1858 100644 --- a/composer.json +++ b/composer.json @@ -7,13 +7,8 @@ "prefer-stable": true, "autoload": { "psr-4": { - "App\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "Dev\\": "dev", - "Tests\\": "tests/" + "Surfnet\\Tiqr\\": "src", + "Surfnet\\Tiqr\\Dev\\": "dev" } }, "require": { diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index f6f455a8..73515758 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -5,4 +5,4 @@ twig: debug: '%kernel.debug%' strict_variables: '%kernel.debug%' globals: - global_view_parameters: '@App\Service\GlobalViewParameters' + global_view_parameters: '@Surfnet\Tiqr\Service\GlobalViewParameters' diff --git a/config/services.yaml b/config/services.yaml index 33fdd9a4..3edf3b34 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -22,7 +22,7 @@ services: # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name - App\: + Surfnet\Tiqr\: resource: '../src/*' exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' @@ -32,25 +32,25 @@ services: Symfony\Component\DependencyInjection\Container: alias: 'service_container' - App\Tiqr\Legacy\TiqrService: - factory: ['App\Tiqr\TiqrFactory', 'createService'] + Surfnet\Tiqr\Tiqr\Legacy\TiqrService: + factory: ['Surfnet\Tiqr\Tiqr\TiqrFactory', 'createService'] - App\Tiqr\Legacy\TiqrUserRepository: - factory: ['App\Tiqr\TiqrFactory', 'createUserRepository'] + Surfnet\Tiqr\Tiqr\Legacy\TiqrUserRepository: + factory: ['Surfnet\Tiqr\Tiqr\TiqrFactory', 'createUserRepository'] - App\Tiqr\TiqrUserRepositoryInterface: - alias: App\Tiqr\Legacy\TiqrUserRepository + Surfnet\Tiqr\Tiqr\TiqrUserRepositoryInterface: + alias: Surfnet\Tiqr\Tiqr\Legacy\TiqrUserRepository surfnet_saml.saml2.bridge_container: class: Surfnet\SamlBundle\SAML2\BridgeContainer arguments: - '@logger' - App\Service\UserAgentMatcher: + Surfnet\Tiqr\Service\UserAgentMatcher: bind: $pattern: '%mobile_app_user_agent_pattern%' - App\Controller\ExceptionController: + Surfnet\Tiqr\Controller\ExceptionController: tags: ['controller.service_arguments'] arguments: - $errorPageHelper: '@App\Service\ErrorPageHelper' + $errorPageHelper: '@Surfnet\Tiqr\Service\ErrorPageHelper' diff --git a/config/services_dev.yaml b/config/services_dev.yaml index 382bd181..be22f548 100644 --- a/config/services_dev.yaml +++ b/config/services_dev.yaml @@ -6,15 +6,15 @@ services: # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name - Dev\: + Surfnet\Tiqr\Dev\: resource: '../dev/*' exclude: '../dev/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' - Dev\Controller\: + Surfnet\Tiqr\Dev\Controller\: resource: '../dev/Controller' tags: ['controller.service_arguments'] # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones GuzzleHttp\Client: class: GuzzleHttp\Client - factory: ['Dev\HttpClientFactory', 'create'] + factory: ['Surfnet\Tiqr\Dev\HttpClientFactory', 'create'] diff --git a/config/services_test.yaml b/config/services_test.yaml index ee3299e9..67be77dc 100644 --- a/config/services_test.yaml +++ b/config/services_test.yaml @@ -3,16 +3,16 @@ imports: - { resource: 'services_dev.yaml' } services: - Dev\FileLogger: + Surfnet\Tiqr\Dev\FileLogger: public: true decorates: 'logger' arguments: - '@kernel' overide_matcher: - class: App\Service\UserAgentMatcher + class: Surfnet\Tiqr\Service\UserAgentMatcher public: true - decorates: App\Service\UserAgentMatcher + decorates: Surfnet\Tiqr\Service\UserAgentMatcher arguments: - '/^Behat UA$/' diff --git a/dev/Command/AuthenticationCommand.php b/dev/Command/AuthenticationCommand.php index 7ce68704..d433133d 100644 --- a/dev/Command/AuthenticationCommand.php +++ b/dev/Command/AuthenticationCommand.php @@ -17,7 +17,7 @@ declare(strict_types = 1); -namespace Dev\Command; +namespace Surfnet\Tiqr\Dev\Command; use GuzzleHttp\Client; use OCRA; diff --git a/dev/Command/RegistrationCommand.php b/dev/Command/RegistrationCommand.php index ad214682..bc0cd78b 100644 --- a/dev/Command/RegistrationCommand.php +++ b/dev/Command/RegistrationCommand.php @@ -17,7 +17,7 @@ declare(strict_types = 1); -namespace Dev\Command; +namespace Surfnet\Tiqr\Dev\Command; use GuzzleHttp\Client; use RuntimeException; diff --git a/dev/Controller/QrLinkController.php b/dev/Controller/QrLinkController.php index 46012aaa..f5c3fd62 100644 --- a/dev/Controller/QrLinkController.php +++ b/dev/Controller/QrLinkController.php @@ -17,15 +17,15 @@ declare(strict_types = 1); -namespace Dev\Controller; +namespace Surfnet\Tiqr\Dev\Controller; -use App\Tiqr\TiqrServiceInterface; use InvalidArgumentException; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\Routing\Annotation\Route; +use Surfnet\Tiqr\Tiqr\TiqrServiceInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\Routing\Annotation\Route; /** * Exposes the qr codes as links. diff --git a/dev/Controller/SPController.php b/dev/Controller/SPController.php index 139b831e..6bb23e4e 100644 --- a/dev/Controller/SPController.php +++ b/dev/Controller/SPController.php @@ -18,28 +18,26 @@ declare(strict_types = 1); -namespace Dev\Controller; +namespace Surfnet\Tiqr\Dev\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Response as SymfonyResponse; -use Symfony\Component\Routing\Annotation\Route; use DOMDocument; use RobRichards\XMLSecLibs\XMLSecurityKey; -use SAML2\Assertion; use SAML2\Certificate\PrivateKeyLoader; use SAML2\Configuration\PrivateKey; use SAML2\DOMDocumentFactory; use SAML2\Message; use SAML2\Response; -use Surfnet\GsspBundle\Service\RegistrationService; use Surfnet\SamlBundle\Entity\IdentityProvider; use Surfnet\SamlBundle\Entity\ServiceProvider; use Surfnet\SamlBundle\Http\Exception\AuthnFailedSamlResponseException; use Surfnet\SamlBundle\Http\PostBinding; use Surfnet\SamlBundle\SAML2\AuthnRequest; use Surfnet\SamlBundle\SAML2\AuthnRequestFactory; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response as SymfonyResponse; +use Symfony\Component\Routing\Annotation\Route; /** * Demo SP. diff --git a/dev/FileLogger.php b/dev/FileLogger.php index 6c0ec206..001702de 100644 --- a/dev/FileLogger.php +++ b/dev/FileLogger.php @@ -17,7 +17,7 @@ declare(strict_types = 1); -namespace Dev; +namespace Surfnet\Tiqr\Dev; use League\Csv\Reader; use League\Csv\Writer; diff --git a/dev/HttpClientFactory.php b/dev/HttpClientFactory.php index 41e30e4b..a3c80f71 100644 --- a/dev/HttpClientFactory.php +++ b/dev/HttpClientFactory.php @@ -17,7 +17,7 @@ declare(strict_types = 1); -namespace Dev; +namespace Surfnet\Tiqr\Dev; use GuzzleHttp\Client; diff --git a/dev/Twig/GsspExtension.php b/dev/Twig/GsspExtension.php index fe61dc21..d4041163 100644 --- a/dev/Twig/GsspExtension.php +++ b/dev/Twig/GsspExtension.php @@ -17,7 +17,7 @@ declare(strict_types = 1); -namespace Dev\Twig; +namespace Surfnet\Tiqr\Dev\Twig; use Surfnet\SamlBundle\Entity\HostedEntities; use Twig\Extension\AbstractExtension; diff --git a/public/index.php b/public/index.php index a20b1e57..4cc75fb3 100644 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,5 @@