From 40c6cb1dba385479e84d773181d5e56a18cf677a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D?= Date: Wed, 1 May 2024 12:03:55 +0200 Subject: [PATCH] chore: Use strict types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rubén D --- lib/SP/Core/Acl/Acl.php | 1 + lib/SP/Core/Acl/Actions.php | 1 + lib/SP/Core/Application.php | 1 + lib/SP/Core/Bootstrap/BootstrapBase.php | 1 + lib/SP/Core/Bootstrap/RouteContext.php | 1 + .../Core/Bootstrap/UpgradeConfigChecker.php | 1 + lib/SP/Core/Bootstrap/UriContext.php | 1 + lib/SP/Core/Context/ContextBase.php | 1 + lib/SP/Core/Context/ContextCollection.php | 3 +- lib/SP/Core/Context/ContextException.php | 1 + lib/SP/Core/Context/ContextFactory.php | 1 + lib/SP/Core/Context/Session.php | 1 + lib/SP/Core/Context/SessionUtil.php | 1 + lib/SP/Core/Context/StatelessContext.php | 1 + lib/SP/Core/Crypt/Cookie.php | 1 + lib/SP/Core/Crypt/Crypt.php | 1 + lib/SP/Core/Crypt/CryptPKI.php | 1 + lib/SP/Core/Crypt/CryptSessionHandler.php | 1 + lib/SP/Core/Crypt/Csrf.php | 1 + lib/SP/Core/Crypt/Hash.php | 1 + lib/SP/Core/Crypt/RequestBasedPassword.php | 1 + lib/SP/Core/Crypt/Session.php | 1 + lib/SP/Core/Crypt/UuidCookie.php | 1 + lib/SP/Core/Crypt/Vault.php | 1 + lib/SP/Core/DataCollection.php | 1 + lib/SP/Core/Definitions/CoreDefinitions.php | 1 + lib/SP/Core/Definitions/DomainDefinitions.php | 1 + lib/SP/Core/Events/Event.php | 1 + lib/SP/Core/Events/EventDispatcher.php | 3 +- lib/SP/Core/Events/EventDispatcherBase.php | 1 + lib/SP/Core/Events/EventMessage.php | 6 +- lib/SP/Core/HttpModuleBase.php | 1 + lib/SP/Core/Language.php | 1 + lib/SP/Core/Messages/HtmlFormatter.php | 1 + lib/SP/Core/Messages/MailMessage.php | 1 + lib/SP/Core/Messages/MessageBase.php | 1 + lib/SP/Core/Messages/NotificationMessage.php | 1 + lib/SP/Core/Messages/TaskMessage.php | 1 + lib/SP/Core/Messages/TextFormatter.php | 1 + lib/SP/Core/MimeTypes.php | 1 + lib/SP/Core/ModuleBase.php | 1 + lib/SP/Core/PhpExtensionChecker.php | 1 + lib/SP/Core/ProvidersHelper.php | 1 + lib/SP/Core/UI/Theme.php | 1 + lib/SP/Core/UI/ThemeContext.php | 1 + lib/SP/Core/UI/ThemeIcons.php | 1 + lib/SP/Domain/Account/Adapters/Account.php | 1 + .../Adapters/AccountPassItemWithIdAndName.php | 1 + .../Account/Adapters/AccountPermission.php | 1 + .../Account/Adapters/AccountSearchItem.php | 35 +++--------- lib/SP/Domain/Account/Dtos/AccountAclDto.php | 1 + .../Domain/Account/Dtos/AccountCacheDto.php | 1 + .../Domain/Account/Dtos/AccountCreateDto.php | 1 + lib/SP/Domain/Account/Dtos/AccountDto.php | 14 +++-- .../Account/Dtos/AccountEnrichedDto.php | 19 ++++--- .../Account/Dtos/AccountHistoryCreateDto.php | 1 + .../Domain/Account/Dtos/AccountHistoryDto.php | 56 ++++++++++--------- .../Account/Dtos/AccountPasswordRequest.php | 1 + lib/SP/Domain/Account/Dtos/AccountRequest.php | 1 + .../Account/Dtos/AccountSearchFilterDto.php | 1 + .../Account/Dtos/AccountSearchTokensDto.php | 1 + .../Account/Dtos/AccountUpdateBulkDto.php | 1 + .../Domain/Account/Dtos/AccountUpdateDto.php | 1 + .../Domain/Account/Dtos/EncryptedPassword.php | 1 + lib/SP/Domain/Account/Dtos/PublicLinkKey.php | 1 + lib/SP/Domain/Account/Models/Account.php | 10 ++-- .../Domain/Account/Models/AccountHistory.php | 1 + .../Account/Models/AccountSearchView.php | 14 +++-- .../Domain/Account/Models/AccountToUser.php | 1 + .../Account/Models/AccountToUserGroup.php | 1 + .../Domain/Account/Models/AccountUseCases.php | 1 + lib/SP/Domain/Account/Models/AccountView.php | 10 ++-- lib/SP/Domain/Account/Models/File.php | 1 + lib/SP/Domain/Account/Models/FileExtData.php | 1 + lib/SP/Domain/Account/Models/PublicLink.php | 1 + .../Domain/Account/Models/PublicLinkList.php | 1 + .../Account/Ports/AccountAclService.php | 1 + .../Domain/Account/Ports/AccountAdapter.php | 1 + .../Account/Ports/AccountCacheService.php | 1 + .../Account/Ports/AccountCryptService.php | 1 + .../Account/Ports/AccountFileRepository.php | 1 + .../Account/Ports/AccountFileService.php | 1 + .../Account/Ports/AccountFilterBuilder.php | 1 + .../Ports/AccountHistoryRepository.php | 1 + .../Account/Ports/AccountHistoryService.php | 1 + .../Account/Ports/AccountItemsService.php | 1 + .../Account/Ports/AccountPresetService.php | 1 + .../Account/Ports/AccountRepository.php | 1 + .../Account/Ports/AccountSearchConstants.php | 1 + .../Ports/AccountSearchDataBuilder.php | 1 + .../Account/Ports/AccountSearchRepository.php | 1 + .../Account/Ports/AccountSearchService.php | 1 + .../Domain/Account/Ports/AccountService.php | 1 + .../Ports/AccountToFavoriteRepository.php | 1 + .../Ports/AccountToFavoriteService.php | 1 + .../Account/Ports/AccountToTagRepository.php | 1 + .../Account/Ports/AccountToTagService.php | 1 + .../Ports/AccountToUserGroupRepository.php | 1 + .../Ports/AccountToUserGroupService.php | 1 + .../Account/Ports/AccountToUserRepository.php | 1 + .../Account/Ports/AccountToUserService.php | 1 + .../Account/Ports/PublicLinkRepository.php | 1 + .../Account/Ports/PublicLinkService.php | 1 + .../Ports/UpgradePublicLinkService.php | 1 + lib/SP/Domain/Account/Services/Account.php | 5 +- lib/SP/Domain/Account/Services/AccountAcl.php | 1 + .../Domain/Account/Services/AccountCache.php | 1 + .../Domain/Account/Services/AccountCrypt.php | 1 + .../Domain/Account/Services/AccountFile.php | 1 + .../Account/Services/AccountHistory.php | 1 + .../Domain/Account/Services/AccountItems.php | 1 + .../Domain/Account/Services/AccountPreset.php | 1 + .../Domain/Account/Services/AccountSearch.php | 1 + .../Account/Services/AccountToFavorite.php | 1 + .../Domain/Account/Services/AccountToTag.php | 1 + .../Domain/Account/Services/AccountToUser.php | 1 + .../Account/Services/AccountToUserGroup.php | 1 + .../Services/Builders/AccountFilter.php | 1 + .../Services/Builders/AccountSearchData.php | 4 +- .../Builders/AccountSearchTokenizer.php | 1 + lib/SP/Domain/Account/Services/PublicLink.php | 1 + lib/SP/Domain/Api/Dtos/ApiRequestData.php | 1 + lib/SP/Domain/Api/Dtos/ApiResponse.php | 1 + lib/SP/Domain/Api/Ports/ApiRequestService.php | 1 + lib/SP/Domain/Api/Ports/ApiService.php | 1 + lib/SP/Domain/Api/Services/Api.php | 1 + lib/SP/Domain/Api/Services/ApiRequest.php | 1 + .../Api/Services/ApiRequestException.php | 1 + lib/SP/Domain/Api/Services/ApiStatuses.php | 1 + .../Domain/Api/Services/JsonRpcResponse.php | 1 + lib/SP/Domain/Auth/Dtos/LdapCheckResults.php | 1 + lib/SP/Domain/Auth/Dtos/LoginResponseDto.php | 1 + lib/SP/Domain/Auth/Dtos/UserLoginDto.php | 1 + lib/SP/Domain/Auth/Models/AuthToken.php | 1 + .../Auth/Ports/AuthTokenActionInterface.php | 1 + .../Domain/Auth/Ports/AuthTokenRepository.php | 1 + lib/SP/Domain/Auth/Ports/AuthTokenService.php | 1 + .../Domain/Auth/Ports/LdapActionsService.php | 1 + lib/SP/Domain/Auth/Ports/LdapAuthService.php | 1 + lib/SP/Domain/Auth/Ports/LdapCheckService.php | 1 + .../Auth/Ports/LdapConnectionInterface.php | 1 + lib/SP/Domain/Auth/Ports/LdapService.php | 1 + .../Auth/Ports/LoginAuthHandlerService.php | 1 + .../Auth/Ports/LoginMasterPassService.php | 1 + lib/SP/Domain/Auth/Ports/LoginService.php | 1 + lib/SP/Domain/Auth/Ports/LoginUserService.php | 1 + .../Auth/Ports/UpgradeAuthTokenService.php | 1 + lib/SP/Domain/Auth/Providers/AclHandler.php | 1 + lib/SP/Domain/Auth/Providers/AuthDataBase.php | 1 + lib/SP/Domain/Auth/Providers/AuthProvider.php | 1 + .../Auth/Providers/AuthProviderService.php | 1 + lib/SP/Domain/Auth/Providers/AuthResult.php | 1 + lib/SP/Domain/Auth/Providers/AuthService.php | 1 + lib/SP/Domain/Auth/Providers/AuthType.php | 1 + .../Auth/Providers/Browser/BrowserAuth.php | 1 + .../Providers/Browser/BrowserAuthData.php | 1 + .../Providers/Browser/BrowserAuthService.php | 1 + .../Auth/Providers/Database/DatabaseAuth.php | 1 + .../Providers/Database/DatabaseAuthData.php | 1 + .../Database/DatabaseAuthService.php | 1 + .../Providers/Ldap/AttributeCollection.php | 1 + .../Auth/Providers/Ldap/LdapActions.php | 35 ++++++------ .../Domain/Auth/Providers/Ldap/LdapAuth.php | 1 + .../Auth/Providers/Ldap/LdapAuthData.php | 1 + .../Domain/Auth/Providers/Ldap/LdapBase.php | 14 ++++- .../Auth/Providers/Ldap/LdapCodeEnum.php | 1 + .../Auth/Providers/Ldap/LdapConnection.php | 1 + .../Auth/Providers/Ldap/LdapException.php | 1 + .../Domain/Auth/Providers/Ldap/LdapMsAds.php | 1 + .../Domain/Auth/Providers/Ldap/LdapParams.php | 1 + .../Auth/Providers/Ldap/LdapResults.php | 1 + lib/SP/Domain/Auth/Providers/Ldap/LdapStd.php | 5 +- .../Auth/Providers/Ldap/LdapTypeEnum.php | 1 + .../Domain/Auth/Providers/Ldap/LdapUtil.php | 3 +- lib/SP/Domain/Auth/Services/AuthException.php | 1 + lib/SP/Domain/Auth/Services/AuthToken.php | 1 + .../Domain/Auth/Services/AuthTokenAction.php | 1 + lib/SP/Domain/Auth/Services/LdapCheck.php | 1 + lib/SP/Domain/Auth/Services/Login.php | 1 + .../Domain/Auth/Services/LoginAuthHandler.php | 1 + lib/SP/Domain/Auth/Services/LoginBase.php | 1 + .../Domain/Auth/Services/LoginMasterPass.php | 1 + lib/SP/Domain/Auth/Services/LoginStatus.php | 1 + lib/SP/Domain/Auth/Services/LoginUser.php | 1 + lib/SP/Domain/Category/Adapters/Category.php | 1 + lib/SP/Domain/Category/Models/Category.php | 1 + .../Domain/Category/Ports/CategoryAdapter.php | 1 + .../Category/Ports/CategoryRepository.php | 1 + .../Domain/Category/Ports/CategoryService.php | 1 + lib/SP/Domain/Category/Services/Category.php | 1 + lib/SP/Domain/Client/Adapters/Client.php | 1 + lib/SP/Domain/Client/Models/Client.php | 1 + lib/SP/Domain/Client/Ports/ClientAdapter.php | 1 + .../Domain/Client/Ports/ClientRepository.php | 1 + lib/SP/Domain/Client/Ports/ClientService.php | 1 + lib/SP/Domain/Client/Services/Client.php | 1 + lib/SP/Domain/Common/Adapters/Adapter.php | 1 + lib/SP/Domain/Common/Adapters/Date.php | 1 + lib/SP/Domain/Common/Adapters/Serde.php | 1 + .../Domain/Common/Attributes/Encryptable.php | 1 + .../Domain/Common/Attributes/Hydratable.php | 1 + lib/SP/Domain/Common/Dtos/Dto.php | 1 + lib/SP/Domain/Common/Dtos/ItemDataTrait.php | 1 + .../Domain/Common/Models/HydratableModel.php | 1 + lib/SP/Domain/Common/Models/Item.php | 1 + .../Common/Models/ItemWithIdAndNameModel.php | 1 + lib/SP/Domain/Common/Models/Model.php | 8 ++- .../Domain/Common/Models/SerializedModel.php | 1 + lib/SP/Domain/Common/Models/Simple.php | 1 + lib/SP/Domain/Common/Ports/Repository.php | 1 + .../Domain/Common/Providers/Environment.php | 1 + .../Domain/Common/Providers/EventsTrait.php | 1 + lib/SP/Domain/Common/Providers/Filter.php | 1 + lib/SP/Domain/Common/Providers/Http.php | 1 + lib/SP/Domain/Common/Providers/Image.php | 3 +- lib/SP/Domain/Common/Providers/Link.php | 1 + lib/SP/Domain/Common/Providers/Password.php | 1 + lib/SP/Domain/Common/Providers/Provider.php | 1 + lib/SP/Domain/Common/Providers/Version.php | 1 + lib/SP/Domain/Common/Services/Service.php | 1 + .../Common/Services/ServiceException.php | 1 + lib/SP/Domain/Config/Adapters/ConfigData.php | 1 + lib/SP/Domain/Config/Dtos/ConfigRequest.php | 1 + lib/SP/Domain/Config/Models/Config.php | 1 + .../Config/Ports/ConfigBackupService.php | 1 + .../Config/Ports/ConfigDataInterface.php | 1 + .../Domain/Config/Ports/ConfigFileService.php | 1 + .../Domain/Config/Ports/ConfigRepository.php | 1 + lib/SP/Domain/Config/Ports/ConfigService.php | 1 + .../Config/Ports/UpgradeConfigService.php | 1 + lib/SP/Domain/Config/Services/Config.php | 1 + .../Domain/Config/Services/ConfigBackup.php | 4 +- lib/SP/Domain/Config/Services/ConfigFile.php | 1 + lib/SP/Domain/Config/Services/ConfigUtil.php | 1 + .../Domain/Config/Services/UpgradeConfig.php | 1 + .../Core/Acl/AccountPermissionException.php | 1 + .../Domain/Core/Acl/AclActionsInterface.php | 1 + lib/SP/Domain/Core/Acl/AclInterface.php | 1 + .../Core/Acl/ActionNotFoundException.php | 1 + lib/SP/Domain/Core/Acl/ActionsInterface.php | 1 + .../Core/Acl/UnauthorizedActionException.php | 1 + .../Core/Acl/UnauthorizedPageException.php | 1 + lib/SP/Domain/Core/AppInfoInterface.php | 1 + .../Core/Bootstrap/BootstrapInterface.php | 1 + .../Domain/Core/Bootstrap/ModuleInterface.php | 1 + .../Core/Bootstrap/RouteContextData.php | 1 + .../Core/Bootstrap/UriContextInterface.php | 1 + lib/SP/Domain/Core/Context/Context.php | 1 + lib/SP/Domain/Core/Context/SessionContext.php | 1 + lib/SP/Domain/Core/Crypt/CryptInterface.php | 1 + .../Domain/Core/Crypt/CryptPKIInterface.php | 1 + lib/SP/Domain/Core/Crypt/CsrfInterface.php | 1 + .../Crypt/RequestBasedPasswordInterface.php | 1 + .../Domain/Core/Crypt/UuidCookieInterface.php | 1 + lib/SP/Domain/Core/Crypt/VaultInterface.php | 1 + lib/SP/Domain/Core/Dtos/ItemSearchDto.php | 1 + .../Core/Events/EventDispatcherInterface.php | 1 + lib/SP/Domain/Core/Events/EventReceiver.php | 1 + lib/SP/Domain/Core/Events/EventSource.php | 1 + .../Domain/Core/Exceptions/CheckException.php | 1 + .../Core/Exceptions/ConfigException.php | 1 + .../Core/Exceptions/ConstraintException.php | 1 + .../Domain/Core/Exceptions/CryptException.php | 1 + .../Core/Exceptions/FileNotFoundException.php | 1 + .../Exceptions/InitializationException.php | 1 + .../Domain/Core/Exceptions/InstallError.php | 1 + .../Exceptions/InvalidArgumentException.php | 1 + .../Core/Exceptions/InvalidClassException.php | 1 + .../Core/Exceptions/InvalidImageException.php | 1 + .../Domain/Core/Exceptions/ItemException.php | 1 + .../Exceptions/NoSuchPropertyException.php | 1 + .../Domain/Core/Exceptions/QueryException.php | 1 + lib/SP/Domain/Core/Exceptions/SPException.php | 1 + .../Domain/Core/Exceptions/SessionTimeout.php | 1 + lib/SP/Domain/Core/Exceptions/Type.php | 1 + .../Core/Exceptions/ValidationException.php | 1 + lib/SP/Domain/Core/File/MimeType.php | 1 + lib/SP/Domain/Core/File/MimeTypesService.php | 1 + lib/SP/Domain/Core/ItemsTypeInterface.php | 1 + lib/SP/Domain/Core/LanguageInterface.php | 1 + .../Core/Messages/FormatterInterface.php | 1 + .../Domain/Core/Messages/MessageInterface.php | 1 + lib/SP/Domain/Core/Models/Action.php | 1 + lib/SP/Domain/Core/Models/EncryptedModel.php | 1 + .../Core/PhpExtensionCheckerService.php | 1 + .../Domain/Core/UI/ThemeContextInterface.php | 1 + lib/SP/Domain/Core/UI/ThemeIconsInterface.php | 1 + lib/SP/Domain/Core/UI/ThemeInterface.php | 1 + .../Crypt/Dtos/UpdateMasterPassRequest.php | 1 + .../Domain/Crypt/Ports/MasterPassService.php | 1 + .../Crypt/Ports/SecureSessionService.php | 1 + .../Ports/TemporaryMasterPassService.php | 1 + lib/SP/Domain/Crypt/Services/MasterPass.php | 3 +- .../Domain/Crypt/Services/SecureSession.php | 1 + .../Crypt/Services/TemporaryMasterPass.php | 16 +++--- .../CustomField/Adapters/CustomField.php | 1 + .../CustomField/Models/CustomFieldData.php | 1 + .../Models/CustomFieldDefinition.php | 1 + .../CustomField/Models/CustomFieldType.php | 1 + .../CustomField/Ports/CustomFieldAdapter.php | 1 + .../Ports/CustomFieldCryptService.php | 1 + .../Ports/CustomFieldDataRepository.php | 1 + .../Ports/CustomFieldDataService.php | 1 + .../Ports/CustomFieldDefinitionRepository.php | 1 + .../Ports/CustomFieldDefinitionService.php | 1 + .../Ports/CustomFieldTypeRepository.php | 1 + .../Ports/CustomFieldTypeService.php | 1 + .../Ports/UpgradeCustomFieldDataService.php | 1 + .../UpgradeCustomFieldDefinitionService.php | 1 + .../CustomField/Services/CustomFieldCrypt.php | 1 + .../CustomField/Services/CustomFieldData.php | 1 + .../Services/CustomFieldDefinition.php | 1 + .../CustomField/Services/CustomFieldItem.php | 1 + .../CustomField/Services/CustomFieldType.php | 1 + .../Database/Ports/DatabaseFileInterface.php | 1 + .../Database/Ports/DatabaseInterface.php | 1 + .../Database/Ports/DbStorageHandler.php | 1 + .../Database/Ports/QueryDataInterface.php | 1 + .../Export/Ports/BackupFileHelperService.php | 1 + .../Domain/Export/Ports/BackupFileService.php | 1 + .../Export/Ports/XmlAccountExportService.php | 1 + .../Export/Ports/XmlCategoryExportService.php | 1 + .../Export/Ports/XmlClientExportService.php | 1 + .../Export/Ports/XmlExportEntityService.php | 1 + .../Domain/Export/Ports/XmlExportService.php | 1 + .../Export/Ports/XmlTagExportService.php | 1 + .../Domain/Export/Ports/XmlVerifyService.php | 1 + lib/SP/Domain/Export/Services/BackupFile.php | 3 +- .../Export/Services/BackupFileHelper.php | 1 + .../Domain/Export/Services/VerifyResult.php | 1 + .../Export/Services/XmlAccountExport.php | 10 ++-- .../Export/Services/XmlCategoryExport.php | 3 +- .../Export/Services/XmlClientExport.php | 3 +- lib/SP/Domain/Export/Services/XmlExport.php | 3 +- .../Export/Services/XmlExportEntityBase.php | 1 + .../Domain/Export/Services/XmlTagExport.php | 3 +- lib/SP/Domain/Export/Services/XmlTrait.php | 1 + lib/SP/Domain/Export/Services/XmlVerify.php | 1 + .../File/Ports/ArchiveHandlerInterface.php | 1 + .../File/Ports/DirectoryHandlerService.php | 1 + .../File/Ports/FileHandlerInterface.php | 1 + lib/SP/Domain/Html/Html.php | 3 +- lib/SP/Domain/Html/Ports/MinifyService.php | 1 + lib/SP/Domain/Html/Services/Minify.php | 1 + lib/SP/Domain/Html/Services/MinifyCss.php | 1 + lib/SP/Domain/Html/Services/MinifyFile.php | 1 + lib/SP/Domain/Html/Services/MinifyJs.php | 1 + lib/SP/Domain/Http/Adapters/Address.php | 1 + lib/SP/Domain/Http/Client.php | 1 + lib/SP/Domain/Http/Dtos/JsonMessage.php | 1 + lib/SP/Domain/Http/Header.php | 3 +- lib/SP/Domain/Http/Method.php | 1 + .../Domain/Http/Ports/JsonResponseService.php | 1 + lib/SP/Domain/Http/Ports/RequestService.php | 1 + lib/SP/Domain/Http/Providers/Uri.php | 1 + lib/SP/Domain/Http/Services/JsonResponse.php | 1 + lib/SP/Domain/Http/Services/Request.php | 1 + lib/SP/Domain/Image/Ports/ImageService.php | 1 + .../Domain/Import/Dtos/CsvImportParamsDto.php | 1 + lib/SP/Domain/Import/Dtos/ImportParamsDto.php | 1 + .../Import/Dtos/LdapImportParamsDto.php | 1 + .../Import/Dtos/LdapImportResultsDto.php | 1 + .../Import/Ports/ImportHelperInterface.php | 1 + lib/SP/Domain/Import/Ports/ImportService.php | 1 + .../Import/Ports/ImportStrategyService.php | 1 + .../Import/Ports/ItemsImportService.php | 1 + .../Domain/Import/Ports/LdapImportService.php | 1 + lib/SP/Domain/Import/Ports/XmlFileService.php | 1 + .../Domain/Import/Ports/XmlImportService.php | 1 + lib/SP/Domain/Import/Services/CsvImport.php | 1 + lib/SP/Domain/Import/Services/Import.php | 1 + lib/SP/Domain/Import/Services/ImportBase.php | 1 + .../Import/Services/ImportException.php | 1 + .../Domain/Import/Services/ImportHelper.php | 1 + .../Domain/Import/Services/ImportStrategy.php | 1 + .../Domain/Import/Services/KeepassImport.php | 1 + lib/SP/Domain/Import/Services/LdapImport.php | 1 + .../Domain/Import/Services/SyspassImport.php | 10 ++-- lib/SP/Domain/Import/Services/XmlFile.php | 4 +- lib/SP/Domain/Import/Services/XmlFormat.php | 1 + .../Domain/Import/Services/XmlImportBase.php | 1 + .../Domain/Install/Adapters/InstallData.php | 1 + .../Install/Adapters/InstallDataFactory.php | 1 + .../Domain/Install/Ports/InstallerService.php | 1 + .../Services/DatabaseSetupInterface.php | 1 + lib/SP/Domain/Install/Services/Installer.php | 10 ++-- .../Domain/Install/Services/MysqlService.php | 1 + .../Install/Services/MysqlSetupBuilder.php | 1 + .../Services/MysqlSetupBuilderInterface.php | 1 + .../ItemPreset/Models/AccountPermission.php | 1 + .../ItemPreset/Models/AccountPrivate.php | 1 + .../Domain/ItemPreset/Models/ItemPreset.php | 1 + lib/SP/Domain/ItemPreset/Models/Password.php | 1 + .../ItemPreset/Models/SessionTimeout.php | 1 + .../ItemPreset/Ports/ItemPresetInterface.php | 1 + .../ItemPreset/Ports/ItemPresetRepository.php | 1 + .../ItemPreset/Ports/ItemPresetService.php | 1 + .../ItemPreset/Ports/PresetInterface.php | 1 + .../Domain/ItemPreset/Services/ItemPreset.php | 1 + .../Domain/Log/Ports/FileHandlerProvider.php | 1 + lib/SP/Domain/Log/Ports/ProviderInterface.php | 1 + .../Domain/Log/Providers/DatabaseHandler.php | 1 + lib/SP/Domain/Log/Providers/FileHandler.php | 1 + lib/SP/Domain/Log/Providers/LogInterface.php | 1 + lib/SP/Domain/Log/Providers/LoggerBase.php | 1 + .../Log/Providers/RemoteSyslogHandler.php | 1 + lib/SP/Domain/Log/Providers/SyslogHandler.php | 1 + .../Domain/Notification/Dtos/MailParams.php | 1 + .../Notification/Models/Notification.php | 1 + .../Domain/Notification/Ports/MailService.php | 1 + .../Notification/Ports/MailerInterface.php | 1 + .../Ports/NotificationRepository.php | 1 + .../Ports/NotificationService.php | 1 + .../Notification/Providers/MailHandler.php | 1 + .../Providers/MailProviderException.php | 1 + .../Providers/NotificationHandler.php | 1 + .../Providers/PhpMailerWrapper.php | 1 + lib/SP/Domain/Notification/Services/Mail.php | 1 + .../Notification/Services/Notification.php | 1 + .../Ports/UpgradeServiceDatabaseService.php | 1 + lib/SP/Domain/Plugin/Models/Plugin.php | 1 + lib/SP/Domain/Plugin/Models/PluginData.php | 1 + lib/SP/Domain/Plugin/Ports/Plugin.php | 1 + .../Plugin/Ports/PluginCompatilityService.php | 1 + .../Plugin/Ports/PluginDataRepository.php | 1 + .../Domain/Plugin/Ports/PluginDataService.php | 1 + .../Domain/Plugin/Ports/PluginDataStorage.php | 1 + .../Plugin/Ports/PluginLoaderService.php | 1 + .../Plugin/Ports/PluginManagerService.php | 1 + .../Plugin/Ports/PluginOperationInterface.php | 1 + .../Plugin/Ports/PluginRegisterService.php | 1 + .../Domain/Plugin/Ports/PluginRepository.php | 1 + .../Plugin/Ports/PluginUpgraderInterface.php | 1 + .../Plugin/Ports/UpgradePluginService.php | 1 + lib/SP/Domain/Plugin/Services/PluginBase.php | 1 + .../Plugin/Services/PluginCompatility.php | 1 + lib/SP/Domain/Plugin/Services/PluginData.php | 1 + .../Domain/Plugin/Services/PluginLoader.php | 1 + .../Domain/Plugin/Services/PluginManager.php | 1 + .../Plugin/Services/PluginOperation.php | 1 + .../Domain/Plugin/Services/PluginRegister.php | 1 + .../Domain/Plugin/Services/PluginUpgrader.php | 1 + lib/SP/Domain/Security/Dtos/TrackRequest.php | 1 + lib/SP/Domain/Security/Models/Eventlog.php | 1 + lib/SP/Domain/Security/Models/Track.php | 1 + .../Security/Ports/EventlogRepository.php | 1 + .../Domain/Security/Ports/EventlogService.php | 1 + .../Domain/Security/Ports/TrackRepository.php | 1 + lib/SP/Domain/Security/Ports/TrackService.php | 1 + lib/SP/Domain/Security/Services/Eventlog.php | 1 + lib/SP/Domain/Security/Services/Track.php | 12 ++-- .../Domain/Storage/Ports/FileCacheService.php | 1 + .../Storage/Ports/XmlFileStorageService.php | 1 + lib/SP/Domain/Tag/Models/Tag.php | 1 + lib/SP/Domain/Tag/Ports/TagRepository.php | 1 + lib/SP/Domain/Tag/Ports/TagService.php | 1 + lib/SP/Domain/Tag/Services/Tag.php | 1 + .../Domain/Upgrade/Ports/UpgradeService.php | 1 + lib/SP/Domain/Upgrade/Services/UpgradeApp.php | 1 + .../Domain/Upgrade/Services/UpgradeBase.php | 1 + .../Upgrade/Services/UpgradeDatabase.php | 1 + .../Upgrade/Services/UpgradeException.php | 1 + .../Domain/Upgrade/Services/UpgradeUtil.php | 1 + lib/SP/Domain/User/Dtos/UserDataDto.php | 1 + lib/SP/Domain/User/Dtos/UserLoginRequest.php | 1 + lib/SP/Domain/User/Dtos/UserMasterPassDto.php | 1 + lib/SP/Domain/User/Models/ProfileData.php | 1 + lib/SP/Domain/User/Models/User.php | 1 + lib/SP/Domain/User/Models/UserGroup.php | 1 + lib/SP/Domain/User/Models/UserPassRecover.php | 1 + lib/SP/Domain/User/Models/UserPreferences.php | 1 + lib/SP/Domain/User/Models/UserProfile.php | 1 + lib/SP/Domain/User/Models/UserToUserGroup.php | 1 + .../Domain/User/Ports/UserGroupRepository.php | 1 + lib/SP/Domain/User/Ports/UserGroupService.php | 1 + .../User/Ports/UserMasterPassService.php | 1 + .../User/Ports/UserPassRecoverRepository.php | 1 + .../User/Ports/UserPassRecoverService.php | 1 + lib/SP/Domain/User/Ports/UserPassService.php | 1 + .../User/Ports/UserProfileRepository.php | 1 + .../Domain/User/Ports/UserProfileService.php | 1 + lib/SP/Domain/User/Ports/UserRepository.php | 1 + lib/SP/Domain/User/Ports/UserService.php | 1 + .../User/Ports/UserToUserGroupRepository.php | 1 + .../User/Ports/UserToUserGroupService.php | 1 + .../Services/UpdatedMasterPassException.php | 1 + lib/SP/Domain/User/Services/User.php | 1 + lib/SP/Domain/User/Services/UserGroup.php | 1 + .../Domain/User/Services/UserMasterPass.php | 1 + .../User/Services/UserMasterPassStatus.php | 1 + lib/SP/Domain/User/Services/UserPass.php | 8 ++- .../Domain/User/Services/UserPassRecover.php | 1 + lib/SP/Domain/User/Services/UserProfile.php | 1 + .../Domain/User/Services/UserToUserGroup.php | 1 + lib/SP/Html/Assets/FontIcon.php | 1 + lib/SP/Html/Assets/IconBase.php | 1 + lib/SP/Html/Assets/IconInterface.php | 1 + .../Html/DataGrid/Action/DataGridAction.php | 1 + .../DataGrid/Action/DataGridActionBase.php | 1 + .../DataGrid/Action/DataGridActionHelp.php | 1 + .../Action/DataGridActionInterface.php | 1 + .../DataGrid/Action/DataGridActionSearch.php | 1 + .../DataGrid/Action/DataGridActionType.php | 1 + lib/SP/Html/DataGrid/DataGrid.php | 1 + lib/SP/Html/DataGrid/DataGridBase.php | 1 + lib/SP/Html/DataGrid/DataGridData.php | 1 + lib/SP/Html/DataGrid/DataGridDataBase.php | 1 + .../Html/DataGrid/DataGridDataInterface.php | 1 + lib/SP/Html/DataGrid/DataGridInterface.php | 1 + lib/SP/Html/DataGrid/DataGridSort.php | 1 + .../Html/DataGrid/DataGridSortInterface.php | 1 + lib/SP/Html/DataGrid/DataGridTab.php | 1 + .../Html/DataGrid/Layout/DataGridHeader.php | 1 + .../DataGrid/Layout/DataGridHeaderBase.php | 1 + .../Layout/DataGridHeaderInterface.php | 1 + .../DataGrid/Layout/DataGridHeaderSort.php | 1 + lib/SP/Html/DataGrid/Layout/DataGridPager.php | 1 + .../DataGrid/Layout/DataGridPagerBase.php | 1 + .../Layout/DataGridPagerInterface.php | 1 + .../Account/Repositories/Account.php | 1 + .../Account/Repositories/AccountFile.php | 1 + .../Account/Repositories/AccountHistory.php | 1 + .../Account/Repositories/AccountSearch.php | 1 + .../Repositories/AccountToFavorite.php | 1 + .../Account/Repositories/AccountToTag.php | 1 + .../Account/Repositories/AccountToUser.php | 1 + .../Repositories/AccountToUserGroup.php | 1 + .../Account/Repositories/PublicLink.php | 1 + .../Auth/Repositories/AuthToken.php | 1 + .../Category/Repositories/Category.php | 1 + .../Client/Repositories/Client.php | 1 + .../Common/Repositories/BaseRepository.php | 1 + .../Repositories/DuplicatedItemException.php | 1 + .../Repositories/NoSuchItemException.php | 1 + .../Common/Repositories/Query.php | 1 + .../Repositories/RepositoryItemTrait.php | 1 + .../Config/Repositories/Config.php | 1 + .../Repositories/CustomFieldData.php | 1 + .../Repositories/CustomFieldDefinition.php | 1 + .../Repositories/CustomFieldType.php | 1 + lib/SP/Infrastructure/Database/Database.php | 6 +- .../Database/DatabaseConnectionData.php | 1 + .../Database/DatabaseException.php | 1 + .../Infrastructure/Database/DatabaseUtil.php | 1 + .../Database/DbStorageDriver.php | 1 + .../Database/MysqlFileParser.php | 1 + .../Infrastructure/Database/MysqlHandler.php | 1 + lib/SP/Infrastructure/Database/PDOWrapper.php | 1 + lib/SP/Infrastructure/Database/QueryData.php | 1 + .../Infrastructure/Database/QueryResult.php | 1 + lib/SP/Infrastructure/File/ArchiveHandler.php | 1 + .../Infrastructure/File/DirectoryHandler.php | 1 + lib/SP/Infrastructure/File/FileCache.php | 1 + lib/SP/Infrastructure/File/FileCacheBase.php | 1 + lib/SP/Infrastructure/File/FileException.php | 1 + lib/SP/Infrastructure/File/FileHandler.php | 1 + lib/SP/Infrastructure/File/FileSystem.php | 1 + lib/SP/Infrastructure/File/XmlFileStorage.php | 6 +- .../ItemPreset/Repositories/ItemPreset.php | 1 + .../Repositories/Notification.php | 1 + .../Plugin/Repositories/Plugin.php | 1 + .../Plugin/Repositories/PluginData.php | 1 + .../Security/Repositories/Eventlog.php | 1 + .../Security/Repositories/Track.php | 1 + .../Infrastructure/Tag/Repositories/Tag.php | 1 + .../Infrastructure/User/Repositories/User.php | 1 + .../User/Repositories/UserGroup.php | 1 + .../User/Repositories/UserPassRecover.php | 1 + .../User/Repositories/UserProfile.php | 1 + .../User/Repositories/UserToUserGroup.php | 1 + lib/SP/Mvc/Controller/ControllerTrait.php | 1 + .../Controller/CrudControllerInterface.php | 3 +- .../ExtensibleControllerInterface.php | 1 + .../ExtensibleTabControllerInterface.php | 3 +- lib/SP/Mvc/Controller/ItemTrait.php | 4 +- .../Mvc/Controller/SimpleControllerHelper.php | 1 + .../Validators/PasswordValidator.php | 1 + .../Mvc/Controller/Validators/Validator.php | 1 + .../Validators/ValidatorInterface.php | 1 + lib/SP/Mvc/Controller/WebControllerHelper.php | 1 + lib/SP/Mvc/View/Components/DataTab.php | 1 + .../View/Components/ItemAdapterInterface.php | 1 + lib/SP/Mvc/View/Components/SelectItem.php | 1 + .../Mvc/View/Components/SelectItemAdapter.php | 1 + lib/SP/Mvc/View/Template.php | 1 + lib/SP/Mvc/View/TemplateInterface.php | 1 + lib/SP/Mvc/View/TemplateVarCollection.php | 1 + lib/SP/Util/Chainable.php | 1 + lib/SP/Util/Util.php | 1 + .../Account/Services/AccountAclTest.php | 14 +++-- .../Domain/Account/Services/AccountTest.php | 31 ++++++---- .../Auth/Providers/Ldap/LdapActionsTest.php | 26 ++++----- tests/SP/Generators/AccountDataGenerator.php | 17 +++--- tests/SP/Generators/ClientGenerator.php | 2 +- .../CustomFieldDefinitionGenerator.php | 7 ++- .../SP/Generators/PublicLinkDataGenerator.php | 11 ++-- tests/SP/Generators/UserDataGenerator.php | 6 +- 597 files changed, 821 insertions(+), 210 deletions(-) diff --git a/lib/SP/Core/Acl/Acl.php b/lib/SP/Core/Acl/Acl.php index d356a3e1..3d10422a 100644 --- a/lib/SP/Core/Acl/Acl.php +++ b/lib/SP/Core/Acl/Acl.php @@ -1,4 +1,5 @@ details[] = [$this->formatString($key), $this->formatString($value)]; + $this->details[] = [$this->formatString($key), $this->formatString((string)$value)]; $this->detailsCounter++; diff --git a/lib/SP/Core/HttpModuleBase.php b/lib/SP/Core/HttpModuleBase.php index d3e2d3ed..07018b97 100644 --- a/lib/SP/Core/HttpModuleBase.php +++ b/lib/SP/Core/HttpModuleBase.php @@ -1,4 +1,5 @@ tags = self::buildFromItemData($this->tags); } @@ -69,11 +72,6 @@ final class AccountSearchItem return $this->favorite; } - public function setFavorite(bool $favorite): void - { - $this->favorite = $favorite; - } - public function isShowRequest(): bool { return !$this->accountAcl->isShow() && self::$requestEnabled; @@ -100,11 +98,6 @@ final class AccountSearchItem return ($this->accountAcl->isShow() && !self::$optionalActions); } - public function setTextMaxLength(int $textMaxLength): void - { - $this->textMaxLength = $textMaxLength; - } - public function getShortUrl(): string { return Html::truncate($this->accountSearchView->getUrl(), $this->textMaxLength); @@ -151,21 +144,11 @@ final class AccountSearchItem return $this->color; } - public function setColor(string $color): void - { - $this->color = $color; - } - - public function getLink(): ?string + public function getLink(): ?bool { return $this->link; } - public function setLink(string $link): void - { - $this->link = $link; - } - public function getAccesses(): array { $accesses = [ @@ -247,7 +230,7 @@ final class AccountSearchItem } /** - * @return \SP\Domain\Common\Models\Item[] + * @return Item[] */ public function getTags(): array { diff --git a/lib/SP/Domain/Account/Dtos/AccountAclDto.php b/lib/SP/Domain/Account/Dtos/AccountAclDto.php index c49616ef..15d36c84 100644 --- a/lib/SP/Domain/Account/Dtos/AccountAclDto.php +++ b/lib/SP/Domain/Account/Dtos/AccountAclDto.php @@ -1,4 +1,5 @@ getUrl(), notes: $account->getNotes(), userEditId: $account->getUserEditId(), - isPrivate: $account->getIsPrivate(), - isPrivateGroup: $account->getIsPrivateGroup(), + isPrivate: (bool)$account->getIsPrivate(), + isPrivateGroup: (bool)$account->getIsPrivateGroup(), passDateChange: $account->getPassDateChange(), parentId: $account->getParentId(), userGroupId: $account->getUserGroupId(), - otherUserEdit: $account->getOtherUserEdit(), - otherUserGroupEdit: $account->getOtherUserGroupEdit(), + otherUserEdit: (bool)$account->getOtherUserEdit(), + otherUserGroupEdit: (bool)$account->getOtherUserGroupEdit(), ); } @@ -185,7 +187,7 @@ abstract class AccountDto extends Dto public function withPrivate(bool $isPrivate): static { $self = clone $this; - $self->isPrivate = (int)$isPrivate; + $self->isPrivate = $isPrivate; return $self; } @@ -193,7 +195,7 @@ abstract class AccountDto extends Dto public function withPrivateGroup(bool $isPrivateGroup): static { $self = clone $this; - $self->isPrivateGroup = (int)$isPrivateGroup; + $self->isPrivateGroup = $isPrivateGroup; return $self; } diff --git a/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php b/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php index 3d9f7ba5..eadf68d0 100644 --- a/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php +++ b/lib/SP/Domain/Account/Dtos/AccountEnrichedDto.php @@ -1,4 +1,5 @@ isModify; } - public function getDateAdd(): ?int + public function getDateAdd(): ?string { return $this->dateAdd; } - public function getDateEdit(): ?int + public function getDateEdit(): ?string { return $this->dateEdit; } diff --git a/lib/SP/Domain/Account/Dtos/AccountPasswordRequest.php b/lib/SP/Domain/Account/Dtos/AccountPasswordRequest.php index 413b1fd8..2f9bcd0e 100644 --- a/lib/SP/Domain/Account/Dtos/AccountPasswordRequest.php +++ b/lib/SP/Domain/Account/Dtos/AccountPasswordRequest.php @@ -1,4 +1,5 @@ categoryId; } - public function getDateAdd(): ?int + public function getDateAdd(): ?string { return $this->dateAdd; } - public function getDateEdit(): ?int + public function getDateEdit(): ?string { return $this->dateEdit; } diff --git a/lib/SP/Domain/Account/Models/AccountHistory.php b/lib/SP/Domain/Account/Models/AccountHistory.php index 6183b8d1..747d22cf 100644 --- a/lib/SP/Domain/Account/Models/AccountHistory.php +++ b/lib/SP/Domain/Account/Models/AccountHistory.php @@ -1,4 +1,5 @@ countView; } - public function getDateEdit(): ?int + public function getDateEdit(): ?string { return $this->dateEdit; } @@ -156,12 +158,12 @@ final class AccountSearchView extends Model return $this->publicLinkHash; } - public function getPublicLinkDateExpire(): ?string + public function getPublicLinkDateExpire(): ?int { return $this->publicLinkDateExpire; } - public function getPublicLinkTotalCountViews(): ?string + public function getPublicLinkTotalCountViews(): ?int { return $this->publicLinkTotalCountViews; } diff --git a/lib/SP/Domain/Account/Models/AccountToUser.php b/lib/SP/Domain/Account/Models/AccountToUser.php index 35e4625b..e2459786 100644 --- a/lib/SP/Domain/Account/Models/AccountToUser.php +++ b/lib/SP/Domain/Account/Models/AccountToUser.php @@ -1,4 +1,5 @@ categoryId; } - public function getDateAdd(): ?int + public function getDateAdd(): ?string { return $this->dateAdd; } - public function getDateEdit(): ?int + public function getDateEdit(): ?string { return $this->dateEdit; } diff --git a/lib/SP/Domain/Account/Models/File.php b/lib/SP/Domain/Account/Models/File.php index b0752ec7..2f99d599 100644 --- a/lib/SP/Domain/Account/Models/File.php +++ b/lib/SP/Domain/Account/Models/File.php @@ -1,4 +1,5 @@ accountItemsService->updateItems($accountId, $userCanChangePermissions, $accountUpdateDto); + $this->accountItemsService->updateItems($userCanChangePermissions, $accountId, $accountUpdateDto); } }, $this @@ -518,7 +519,7 @@ final class Account extends Service implements AccountService { $this->accountRepository->transactionAware( function () use ($id) { - $this->addHistory($id, 1); + $this->addHistory($id, true); if ($this->accountRepository->delete($id)->getAffectedNumRows() === 0) { throw new NoSuchItemException(__u('Account not found')); diff --git a/lib/SP/Domain/Account/Services/AccountAcl.php b/lib/SP/Domain/Account/Services/AccountAcl.php index 6fd567ed..0016bf86 100644 --- a/lib/SP/Domain/Account/Services/AccountAcl.php +++ b/lib/SP/Domain/Account/Services/AccountAcl.php @@ -1,4 +1,5 @@ accountCacheService->getCacheForAccount( $accountSearchView->getId(), - (int)strtotime($accountSearchView->getDateEdit()) + strtotime($accountSearchView->getDateEdit()) ); // Obtener la ACL de la cuenta diff --git a/lib/SP/Domain/Account/Services/Builders/AccountSearchTokenizer.php b/lib/SP/Domain/Account/Services/Builders/AccountSearchTokenizer.php index d290b440..ff74cd71 100644 --- a/lib/SP/Domain/Account/Services/Builders/AccountSearchTokenizer.php +++ b/lib/SP/Domain/Account/Services/Builders/AccountSearchTokenizer.php @@ -1,4 +1,5 @@ ldapParams->getGroup(), 'cn') === 0) { - return LdapUtil::getGroupName($this->ldapParams->getGroup()) ?: ''; + $group = $this->ldapParams->getGroup(); + + if ($group === null) { + return '*'; } - return $this->ldapParams->getGroup() ?: '*'; + if (stripos($group, 'cn') === 0) { + return LdapUtil::getGroupName($group) ?: ''; + } + + return $group; } /** @@ -187,8 +191,7 @@ final class LdapActions implements LdapActionsService */ public function getAttributes(string $filter): AttributeCollection { - $searchResults = $this->getResults($filter) - ->getFirst(); + $searchResults = $this->getResults($filter)->getFirst(); if ($searchResults === null) { return new AttributeCollection(); @@ -201,7 +204,7 @@ final class LdapActions implements LdapActionsService $attributes = array_filter( self::ATTRIBUTES_MAPPING, - fn($attribute) => isset($results[$attribute]), + static fn(string $attribute) => isset($results[$attribute]), ARRAY_FILTER_USE_KEY ); @@ -215,16 +218,10 @@ final class LdapActions implements LdapActionsService ); } else { // Store first value - $attributeCollection->set( - $map, - trim($results[$attribute][0]) - ); + $attributeCollection->set($map, trim($results[$attribute][0])); } } else { - $attributeCollection->set( - $map, - trim($results[$attribute]) - ); + $attributeCollection->set($map, trim((string)$results[$attribute])); } } diff --git a/lib/SP/Domain/Auth/Providers/Ldap/LdapAuth.php b/lib/SP/Domain/Auth/Providers/Ldap/LdapAuth.php index 9d748595..2c0fa254 100644 --- a/lib/SP/Domain/Auth/Providers/Ldap/LdapAuth.php +++ b/lib/SP/Domain/Auth/Providers/Ldap/LdapAuth.php @@ -1,4 +1,5 @@ ldapParams->getGroup(), 'cn') === 0) { - return LdapUtil::getGroupName($this->ldapParams->getGroup()) ?: ''; + $group = $this->ldapParams->getGroup(); + + if ($group === null) { + return ''; } - return $this->ldapParams->getGroup() ?? ''; + if (stripos($group, 'cn') === 0) { + return LdapUtil::getGroupName($group) ?: ''; + } + + return $group; } /** diff --git a/lib/SP/Domain/Auth/Providers/Ldap/LdapCodeEnum.php b/lib/SP/Domain/Auth/Providers/Ldap/LdapCodeEnum.php index ab596eb0..0d572a25 100644 --- a/lib/SP/Domain/Auth/Providers/Ldap/LdapCodeEnum.php +++ b/lib/SP/Domain/Auth/Providers/Ldap/LdapCodeEnum.php @@ -1,4 +1,5 @@ getGroupFromParams(), null, LDAP_ESCAPE_FILTER); - $member = $userDn !== null ? ldap_escape($userDn, null, LDAP_ESCAPE_FILTER) : '*'; + $groupName = ldap_escape($this->getGroupFromParams(), '', LDAP_ESCAPE_FILTER); + $member = $userDn !== null ? ldap_escape($userDn, '', LDAP_ESCAPE_FILTER) : '*'; if (empty($groupName)) { return $this->getUserObjectFilter(); diff --git a/lib/SP/Domain/Auth/Providers/Ldap/LdapTypeEnum.php b/lib/SP/Domain/Auth/Providers/Ldap/LdapTypeEnum.php index c218f306..efaa7d01 100644 --- a/lib/SP/Domain/Auth/Providers/Ldap/LdapTypeEnum.php +++ b/lib/SP/Domain/Auth/Providers/Ldap/LdapTypeEnum.php @@ -1,4 +1,5 @@ jsonSerialize(), $options & JSON_THROW_ON_ERROR); + return Serde::serializeJson($this, $options); } /** diff --git a/lib/SP/Domain/Common/Models/SerializedModel.php b/lib/SP/Domain/Common/Models/SerializedModel.php index ffe54aa8..0bfa44cb 100644 --- a/lib/SP/Domain/Common/Models/SerializedModel.php +++ b/lib/SP/Domain/Common/Models/SerializedModel.php @@ -1,4 +1,5 @@ configService->save('config_backup', $this->packConfigData($configData)); - $this->configService->save('config_backup_date', time()); + $this->configService->save('config_backup_date', (string)time()); } catch (Exception $e) { processException($e); } diff --git a/lib/SP/Domain/Config/Services/ConfigFile.php b/lib/SP/Domain/Config/Services/ConfigFile.php index e3e752b0..110b7f18 100644 --- a/lib/SP/Domain/Config/Services/ConfigFile.php +++ b/lib/SP/Domain/Config/Services/ConfigFile.php @@ -1,4 +1,5 @@ configService->save(self::PARAM_MASTER_PASS_HASH, $hash); - $this->configService->save(self::PARAM_MASTER_PASS_TIME, time()); + $this->configService->save(self::PARAM_MASTER_PASS_TIME, (string)time()); } } diff --git a/lib/SP/Domain/Crypt/Services/SecureSession.php b/lib/SP/Domain/Crypt/Services/SecureSession.php index 3a06468d..a8440f5a 100644 --- a/lib/SP/Domain/Crypt/Services/SecureSession.php +++ b/lib/SP/Domain/Crypt/Services/SecureSession.php @@ -1,4 +1,5 @@ add(self::PARAM_KEY, $secureKey); $configRequest->add(self::PARAM_HASH, Hash::hashKey($randomKey)); - $configRequest->add(self::PARAM_TIME, time()); - $configRequest->add(self::PARAM_MAX_TIME, $this->maxTime); - $configRequest->add(self::PARAM_ATTEMPTS, 0); + $configRequest->add(self::PARAM_TIME, (string)time()); + $configRequest->add(self::PARAM_MAX_TIME, (string)$this->maxTime); + $configRequest->add(self::PARAM_ATTEMPTS, '0'); $this->configService->saveBatch($configRequest); @@ -174,7 +176,7 @@ final class TemporaryMasterPass extends Service implements TemporaryMasterPassSe ); if (!$isValid) { - $this->configService->save(self::PARAM_ATTEMPTS, $attempts + 1); + $this->configService->save(self::PARAM_ATTEMPTS, (string)($attempts + 1)); } return $isValid; @@ -196,9 +198,9 @@ final class TemporaryMasterPass extends Service implements TemporaryMasterPassSe $configRequest->add(self::PARAM_PASS, ''); $configRequest->add(self::PARAM_KEY, ''); $configRequest->add(self::PARAM_HASH, ''); - $configRequest->add(self::PARAM_TIME, 0); - $configRequest->add(self::PARAM_MAX_TIME, 0); - $configRequest->add(self::PARAM_ATTEMPTS, 0); + $configRequest->add(self::PARAM_TIME, '0'); + $configRequest->add(self::PARAM_MAX_TIME, '0'); + $configRequest->add(self::PARAM_ATTEMPTS, '0'); $this->configService->saveBatch($configRequest); diff --git a/lib/SP/Domain/CustomField/Adapters/CustomField.php b/lib/SP/Domain/CustomField/Adapters/CustomField.php index 1c0517f2..4f2815e9 100644 --- a/lib/SP/Domain/CustomField/Adapters/CustomField.php +++ b/lib/SP/Domain/CustomField/Adapters/CustomField.php @@ -1,4 +1,5 @@ databaseUtil->escape($value); + return $this->databaseUtil->escape((string)$value); } return null; diff --git a/lib/SP/Domain/Export/Services/BackupFileHelper.php b/lib/SP/Domain/Export/Services/BackupFileHelper.php index 28b6d401..059138c4 100644 --- a/lib/SP/Domain/Export/Services/BackupFileHelper.php +++ b/lib/SP/Domain/Export/Services/BackupFileHelper.php @@ -1,4 +1,5 @@ document->createTextNode($account->getName())->nodeValue ); - $accountCustomerId = $this->document->createElement('clientId', $account->getClientId()); - $accountCategoryId = $this->document->createElement('categoryId', $account->getCategoryId()); + $accountCustomerId = $this->document->createElement('clientId', (string)$account->getClientId()); + $accountCategoryId = $this->document->createElement('categoryId', (string)$account->getCategoryId()); $accountLogin = $this->document->createElement( 'login', $this->document->createTextNode($account->getLogin())->nodeValue @@ -110,12 +112,12 @@ final class XmlAccountExport extends XmlExportEntityBase $tag = $this->document->createElement('tag'); $tags->appendChild($tag); - $tag->setAttribute('id', $itemData->getId()); + $tag->setAttribute('id', (string)$itemData->getId()); } // Crear el nodo de cuenta $nodeAccount = $this->document->createElement('Account'); - $nodeAccount->setAttribute('id', $account->getId()); + $nodeAccount->setAttribute('id', (string)$account->getId()); $nodeAccount->appendChild($accountName); $nodeAccount->appendChild($accountCustomerId); $nodeAccount->appendChild($accountCategoryId); diff --git a/lib/SP/Domain/Export/Services/XmlCategoryExport.php b/lib/SP/Domain/Export/Services/XmlCategoryExport.php index d1a0a008..78d8a3e1 100644 --- a/lib/SP/Domain/Export/Services/XmlCategoryExport.php +++ b/lib/SP/Domain/Export/Services/XmlCategoryExport.php @@ -1,4 +1,5 @@ document->createElement('Category'); $nodeCategories->appendChild($nodeCategory); - $nodeCategory->setAttribute('id', $category->getId()); + $nodeCategory->setAttribute('id', (string)$category->getId()); $nodeCategory->appendChild( $this->document->createElement( 'name', diff --git a/lib/SP/Domain/Export/Services/XmlClientExport.php b/lib/SP/Domain/Export/Services/XmlClientExport.php index 39860304..de3acf92 100644 --- a/lib/SP/Domain/Export/Services/XmlClientExport.php +++ b/lib/SP/Domain/Export/Services/XmlClientExport.php @@ -1,4 +1,5 @@ document->createElement('Client'); $nodeClients->appendChild($nodeClient); - $nodeClient->setAttribute('id', $client->getId()); + $nodeClient->setAttribute('id', (string)$client->getId()); $nodeClient->appendChild( $this->document->createElement( 'name', diff --git a/lib/SP/Domain/Export/Services/XmlExport.php b/lib/SP/Domain/Export/Services/XmlExport.php index 9557922e..a5115b05 100644 --- a/lib/SP/Domain/Export/Services/XmlExport.php +++ b/lib/SP/Domain/Export/Services/XmlExport.php @@ -1,4 +1,5 @@ append( $this->document->createElement('Generator', 'sysPass'), $this->document->createElement('Version', Version::getVersionStringNormalized()), - $this->document->createElement('Time', time()), + $this->document->createElement('Time', (string)time()), $this->document->createElement( 'User', $this->document->createTextNode($userData->getLogin())->nodeValue diff --git a/lib/SP/Domain/Export/Services/XmlExportEntityBase.php b/lib/SP/Domain/Export/Services/XmlExportEntityBase.php index 513a6dd7..5e68f419 100644 --- a/lib/SP/Domain/Export/Services/XmlExportEntityBase.php +++ b/lib/SP/Domain/Export/Services/XmlExportEntityBase.php @@ -1,4 +1,5 @@ document->createElement('Tag'); $nodeTags->appendChild($nodeTag); - $nodeTag->setAttribute('id', $tag->getId()); + $nodeTag->setAttribute('id', (string)$tag->getId()); $nodeTag->appendChild( $this->document->createElement('name', $this->document->createTextNode($tag->getName())->nodeValue) ); diff --git a/lib/SP/Domain/Export/Services/XmlTrait.php b/lib/SP/Domain/Export/Services/XmlTrait.php index 9b7ecbce..19b7960f 100644 --- a/lib/SP/Domain/Export/Services/XmlTrait.php +++ b/lib/SP/Domain/Export/Services/XmlTrait.php @@ -1,4 +1,5 @@ document))->query('/Root/Meta/Version')->item(0)?->nodeValue ?? 0 ); } @@ -213,7 +215,7 @@ final class SyspassImport extends XmlImportBase implements ItemsImportService static fn(DOMElement $element) => isset($element->tagName) ); - $data = ['id' => $category->getAttribute('id')]; + $data = ['id' => (int)$category->getAttribute('id')]; /** @var DOMElement $node */ foreach ($nodesIterator as $node) { @@ -256,7 +258,7 @@ final class SyspassImport extends XmlImportBase implements ItemsImportService static fn(DOMElement $element) => isset($element->tagName) ); - $data = ['id' => $client->getAttribute('id')]; + $data = ['id' => (int)$client->getAttribute('id')]; /** @var DOMElement $node */ foreach ($nodesIterator as $node) { diff --git a/lib/SP/Domain/Import/Services/XmlFile.php b/lib/SP/Domain/Import/Services/XmlFile.php index b0a378e9..2d3f4a53 100644 --- a/lib/SP/Domain/Import/Services/XmlFile.php +++ b/lib/SP/Domain/Import/Services/XmlFile.php @@ -1,4 +1,6 @@ document->getElementsByTagName('Generator'); try { - return XmlFormat::from(strtolower($nodes->item(0)?->nodeValue)); + return XmlFormat::from(strtolower($nodes->item(0)?->nodeValue ?? '')); } catch (ValueError $e) { throw ImportException::error( __u('XML file not supported'), diff --git a/lib/SP/Domain/Import/Services/XmlFormat.php b/lib/SP/Domain/Import/Services/XmlFormat.php index 06f79aad..06001681 100644 --- a/lib/SP/Domain/Import/Services/XmlFormat.php +++ b/lib/SP/Domain/Import/Services/XmlFormat.php @@ -1,4 +1,5 @@ installData->setDbSocket($match['socket']); } else { $this->installData->setDbHost($match['host']); - $this->installData->setDbPort($match['port']); + $this->installData->setDbPort((int)$match['port']); } } else { $this->installData->setDbPort(3306); @@ -320,7 +322,7 @@ final class Installer implements InstallerService ) ); $this->configService->create( - new Config(['parameter' => 'lastupdatempass', 'value' => time()]) + new Config(['parameter' => 'lastupdatempass', 'value' => (string)time()]) ); } catch (Exception $e) { processException($e); @@ -344,14 +346,14 @@ final class Installer implements InstallerService ] ); - $userProfile = new UserProfile(['name' => 'Admin', 'profile' => new ProfileData()]); + $userProfile = new UserProfile(['name' => 'Admin', 'profile' => (new ProfileData())->toJson()]); $userData = new User([ 'userGroupId' => $this->userGroupService->create($userGroup), 'userProfileId' => $this->userProfileService->create($userProfile), 'login' => $this->installData->getAdminLogin(), 'name' => 'sysPass Admin', - 'isAdminApp' => 1, + 'isAdminApp' => true, ]); $id = $this->userService->createWithMasterPass( diff --git a/lib/SP/Domain/Install/Services/MysqlService.php b/lib/SP/Domain/Install/Services/MysqlService.php index bc64d966..24b30aee 100644 --- a/lib/SP/Domain/Install/Services/MysqlService.php +++ b/lib/SP/Domain/Install/Services/MysqlService.php @@ -1,4 +1,5 @@ getNumRows(); if ($attempts >= self::TIME_TRACKING_MAX_ATTEMPTS) { - $delaySeconds = self::TIME_SLEEP * $attempts; + $delaySeconds = (int)(self::TIME_SLEEP * $attempts); $this->eventDispatcher->notify( 'track.delay', @@ -121,7 +123,7 @@ final class Track extends Service implements TrackService self::TIME_TRACKING_MAX_ATTEMPTS ) ) - ->addDetail(__u('Seconds'), $delaySeconds) + ->addDetail(__u('Seconds'), (string)$delaySeconds) ) ); diff --git a/lib/SP/Domain/Storage/Ports/FileCacheService.php b/lib/SP/Domain/Storage/Ports/FileCacheService.php index 52ef021e..fd2b3400 100644 --- a/lib/SP/Domain/Storage/Ports/FileCacheService.php +++ b/lib/SP/Domain/Storage/Ports/FileCacheService.php @@ -1,4 +1,5 @@ $id, 'pass' => Hash::hashKey($userPass), - 'isChangePass' => 0, - 'isChangedPass' => 1, - 'isMigrate' => 0 + 'isChangePass' => false, + 'isChangedPass' => true, + 'isMigrate' => false ] ); diff --git a/lib/SP/Domain/User/Services/UserPassRecover.php b/lib/SP/Domain/User/Services/UserPassRecover.php index 1c7b5cc3..d3f29d12 100644 --- a/lib/SP/Domain/User/Services/UserPassRecover.php +++ b/lib/SP/Domain/User/Services/UserPassRecover.php @@ -1,4 +1,5 @@ execute(); - $this->lastId = $connection->lastInsertId(); + $this->lastId = (int)$connection->lastInsertId(); return $stmt; } catch (Exception $e) { @@ -142,7 +144,7 @@ final class Database implements DatabaseInterface throw ConstraintException::error(__u('Integrity constraint'), $e->getMessage(), $e->getCode(), $e); } - throw QueryException::critical($e->getMessage(), $e->getCode(), 0, $e); + throw QueryException::critical($e->getMessage(), (string)$e->getCode(), $e->getCode(), $e); } } diff --git a/lib/SP/Infrastructure/Database/DatabaseConnectionData.php b/lib/SP/Infrastructure/Database/DatabaseConnectionData.php index c7430821..baecb8a0 100644 --- a/lib/SP/Infrastructure/Database/DatabaseConnectionData.php +++ b/lib/SP/Infrastructure/Database/DatabaseConnectionData.php @@ -1,4 +1,5 @@ setAttribute('class', get_class($value)); $this->serializeItems($value, $newNode, $key); } else { - $newNode->appendChild($this->document->createTextNode(trim($value))); + $newNode->appendChild($this->document->createTextNode(trim((string)$value))); } $currentNode->appendChild($newNode); @@ -120,7 +122,7 @@ final readonly class XmlFileStorage implements XmlFileStorageService $value = $property->getValue($object); $items[$property->getName()] = match (true) { - is_bool($value) || (is_numeric($value) && !str_contains($value, '.')) => (int)$value, + is_bool($value) || (is_numeric($value) && !str_contains((string)$value, '.')) => (int)$value, default => $value }; } diff --git a/lib/SP/Infrastructure/ItemPreset/Repositories/ItemPreset.php b/lib/SP/Infrastructure/ItemPreset/Repositories/ItemPreset.php index 1c5f409c..bc9e60b2 100644 --- a/lib/SP/Infrastructure/ItemPreset/Repositories/ItemPreset.php +++ b/lib/SP/Infrastructure/ItemPreset/Repositories/ItemPreset.php @@ -1,4 +1,5 @@ $userId, 'userGroupId' => $groupId, - 'isAdminApp' => (int)$isAdminApp, - 'isAdminAcc' => (int)$isAdminAcc + 'isAdminApp' => $isAdminApp, + 'isAdminAcc' => $isAdminAcc ] ) ) @@ -690,9 +692,13 @@ class AccountAclTest extends UnitaryTestCase $fileCache = $this->createMock(FileCacheService::class); $actions = $this->createMock(ActionsInterface::class); + $lastUpdate = DateTime::createFromFormat('U', (string)($dto->getDateEdit() + 10))->format('Y-m-d H:i:s'); + $this->context->setUserData( new UserDataDto( - UserDataGenerator::factory()->buildUserData()->mutate(['lastUpdate' => $dto->getDateEdit() + 10]) + UserDataGenerator::factory() + ->buildUserData() + ->mutate(['lastUpdate' => $lastUpdate]) ) ); diff --git a/tests/SP/Domain/Account/Services/AccountTest.php b/tests/SP/Domain/Account/Services/AccountTest.php index 6d2f0d26..11e38750 100644 --- a/tests/SP/Domain/Account/Services/AccountTest.php +++ b/tests/SP/Domain/Account/Services/AccountTest.php @@ -1,4 +1,5 @@ willReturn(new QueryResult([$accountDataGenerator->buildAccount()])); $this->configService->expects(self::exactly(count($accountsId)))->method('getByParam') ->with('masterPwd')->willReturn(self::$faker->password); - $this->accountItemsService->expects(self::exactly(count($accountsId)))->method('updateItems') + $this->accountItemsService->expects(self::exactly(count($accountsId))) + ->method('updateItems') ->with( ... self::withConsecutive( ... - array_map(fn($v) => [$v, true, $accounts[$v]], $accountsId) + array_map(fn($v) => [true, $v, $accounts[$v]], $accountsId) ) ); @@ -627,7 +629,7 @@ class AccountTest extends UnitaryTestCase ... self::withConsecutive( ... - array_map(fn($v) => [$v, false, $accounts[$v]], $accountsId) + array_map(fn($v) => [false, $v, $accounts[$v]], $accountsId) ) ); @@ -672,7 +674,7 @@ class AccountTest extends UnitaryTestCase ... self::withConsecutive( ... - array_map(fn($v) => [$v, true, $accounts[$v]], $accountsId) + array_map(fn($v) => [true, $v, $accounts[$v]], $accountsId) ) ); @@ -716,7 +718,7 @@ class AccountTest extends UnitaryTestCase ->with( ...self::withConsecutive( ...array_map( - fn($v) => [$v, true, $accounts[$v]], + fn($v) => [true, $v, $accounts[$v]], $accountsId ) ) @@ -755,17 +757,22 @@ class AccountTest extends UnitaryTestCase $account = AccountDataGenerator::factory()->buildAccount(); $accountHistoryCreateDto = new AccountHistoryCreateDto($account, false, true, $password); - $this->configService->expects(self::once())->method('getByParam') - ->with('masterPwd')->willReturn($password); + $this->configService->expects(self::once()) + ->method('getByParam') + ->with('masterPwd') + ->willReturn($password); - $this->accountRepository->expects(self::once())->method('getById') - ->with($id)->willReturn(new QueryResult([$account])); + $this->accountRepository->expects(self::once()) + ->method('getById') + ->with($id) + ->willReturn(new QueryResult([$account])); $this->accountHistoryService->expects(self::once())->method('create') ->with($accountHistoryCreateDto); - $this->accountRepository->expects(self::once())->method('delete') - ->with($id) - ->willReturn(new QueryResult(null, 1)); + $this->accountRepository->expects(self::once()) + ->method('delete') + ->with($id) + ->willReturn(new QueryResult(null, 1)); $this->account->delete($id); } diff --git a/tests/SP/Domain/Auth/Providers/Ldap/LdapActionsTest.php b/tests/SP/Domain/Auth/Providers/Ldap/LdapActionsTest.php index d84b2103..684ac87a 100644 --- a/tests/SP/Domain/Auth/Providers/Ldap/LdapActionsTest.php +++ b/tests/SP/Domain/Auth/Providers/Ldap/LdapActionsTest.php @@ -1,4 +1,5 @@ createMock(Collection::class); $attributes = $this->buildAttributes(); $this->ldap->expects(self::once()) ->method('search') ->with( - $filter, + 'a_filter', null, Ldap::SEARCH_SCOPE_SUB, [], @@ -135,13 +135,13 @@ class LdapActionsTest extends UnitaryTestCase $collection->expects(self::once())->method('getFirst')->willReturn($attributes); - $out = $this->ldapActions->getAttributes($filter); + $out = $this->ldapActions->getAttributes('a_filter'); $expected = new AttributeCollection([ 'dn' => $attributes['dn'], 'group' => array_filter( $attributes['memberof'], - fn($key) => $key !== 'count', + static fn($key) => $key !== 'count', ARRAY_FILTER_USE_KEY ), 'fullname' => $attributes['displayname'], @@ -160,18 +160,18 @@ class LdapActionsTest extends UnitaryTestCase private function buildAttributes(): array { return [ - 'dn' => self::$faker->userName, + 'dn' => self::$faker->userName(), 'memberof' => [ 'count' => 3, - self::$faker->company, - self::$faker->company, - self::$faker->company, + self::$faker->company(), + self::$faker->company(), + self::$faker->company(), ], - 'displayname' => self::$faker->name, - 'givenname' => self::$faker->firstName, - 'sn' => self::$faker->lastName, - 'mail' => self::$faker->email, - 'lockouttime' => self::$faker->unixTime, + 'displayname' => self::$faker->name(), + 'givenname' => self::$faker->firstName(), + 'sn' => self::$faker->lastName(), + 'mail' => self::$faker->email(), + 'lockouttime' => self::$faker->unixTime(), ]; } diff --git a/tests/SP/Generators/AccountDataGenerator.php b/tests/SP/Generators/AccountDataGenerator.php index 8ebfeac9..6076df57 100644 --- a/tests/SP/Generators/AccountDataGenerator.php +++ b/tests/SP/Generators/AccountDataGenerator.php @@ -1,4 +1,5 @@ $this->faker->name(), 'url' => $this->faker->url(), 'notes' => $this->faker->text(), - 'otherUserEdit' => $this->faker->boolean(), - 'otherUserGroupEdit' => $this->faker->boolean(), - 'dateAdd' => $this->faker->unixTime(), - 'dateEdit' => $this->faker->unixTime(), + 'otherUserEdit' => (int)$this->faker->boolean(), + 'otherUserGroupEdit' => (int)$this->faker->boolean(), + 'dateAdd' => $this->faker->dateTime()->format('Y-m-d H:i:s'), + 'dateEdit' => $this->faker->dateTime()->format('Y-m-d H:i:s'), 'countView' => $this->faker->randomNumber(3), 'countDecrypt' => $this->faker->randomNumber(3), - 'isPrivate' => $this->faker->boolean(), - 'isPrivateGroup' => $this->faker->boolean(), + 'isPrivate' => (int)$this->faker->boolean(), + 'isPrivateGroup' => (int)$this->faker->boolean(), 'passDate' => $this->faker->unixTime(), 'passDateChange' => $this->faker->unixTime(), 'parentId' => $this->faker->randomNumber(3), @@ -208,8 +209,8 @@ final class AccountDataGenerator extends DataGenerator accountId: $this->faker->randomNumber(3), isDelete: (int)$this->faker->boolean(), isModify: (int)$this->faker->boolean(), - dateAdd: $this->faker->unixTime(), - dateEdit: $this->faker->unixTime(), + dateAdd: $this->faker->dateTime()->format('Y-m-d H:i:s'), + dateEdit: $this->faker->dateTime()->format('Y-m-d H:i:s'), passDate: $this->faker->unixTime(), countView: $this->faker->randomNumber(3), countDecrypt: $this->faker->randomNumber(3), diff --git a/tests/SP/Generators/ClientGenerator.php b/tests/SP/Generators/ClientGenerator.php index be744d2b..6f06f082 100644 --- a/tests/SP/Generators/ClientGenerator.php +++ b/tests/SP/Generators/ClientGenerator.php @@ -45,7 +45,7 @@ final class ClientGenerator extends DataGenerator 'name' => $this->faker->colorName(), 'description' => $this->faker->text(), 'hash' => $this->faker->sha1(), - 'isGlobal' => $this->faker->boolean() + 'isGlobal' => (int)$this->faker->boolean() ]; } } diff --git a/tests/SP/Generators/CustomFieldDefinitionGenerator.php b/tests/SP/Generators/CustomFieldDefinitionGenerator.php index f8f48c6f..664aec74 100644 --- a/tests/SP/Generators/CustomFieldDefinitionGenerator.php +++ b/tests/SP/Generators/CustomFieldDefinitionGenerator.php @@ -1,4 +1,5 @@ $this->faker->randomNumber(3), 'name' => $this->faker->colorName(), 'moduleId' => $this->faker->randomNumber(3), - 'required' => $this->faker->boolean(), + 'required' => (int)$this->faker->boolean(), 'help' => $this->faker->text(), - 'showInList' => $this->faker->boolean(), + 'showInList' => (int)$this->faker->boolean(), 'typeId' => $this->faker->randomNumber(3), - 'isEncrypted' => $this->faker->boolean(), + 'isEncrypted' => (int)$this->faker->boolean(), ]; } } diff --git a/tests/SP/Generators/PublicLinkDataGenerator.php b/tests/SP/Generators/PublicLinkDataGenerator.php index 817f7e4d..21791964 100644 --- a/tests/SP/Generators/PublicLinkDataGenerator.php +++ b/tests/SP/Generators/PublicLinkDataGenerator.php @@ -1,4 +1,5 @@ $this->faker->randomNumber(3), 'itemId' => $this->faker->randomNumber(3), - 'hash' => $this->faker->randomNumber(3), + 'hash' => $this->faker->sha1(), 'userId' => $this->faker->randomNumber(3), 'typeId' => $this->faker->randomNumber(3), 'notify' => $this->faker->boolean(), - 'dateAdd' => $this->faker->unixTime(), - 'dateUpdate' => $this->faker->unixTime(), - 'dateExpire' => $this->faker->unixTime(), + 'dateAdd' => $this->faker->unixTime(), + 'dateUpdate' => $this->faker->unixTime(), + 'dateExpire' => $this->faker->unixTime(), 'countViews' => $this->faker->randomNumber(3), 'totalCountViews' => $this->faker->randomNumber(3), 'maxCountViews' => $this->faker->randomNumber(3), - 'useInfo' => serialize($this->getUseInfo()), + 'useInfo' => serialize($this->getUseInfo()), 'data' => $this->faker->text(), ]; } diff --git a/tests/SP/Generators/UserDataGenerator.php b/tests/SP/Generators/UserDataGenerator.php index 8466bf7d..2bc18f47 100644 --- a/tests/SP/Generators/UserDataGenerator.php +++ b/tests/SP/Generators/UserDataGenerator.php @@ -46,7 +46,7 @@ final class UserDataGenerator extends DataGenerator return [ 'id' => $this->faker->randomNumber(3), 'name' => $this->faker->name(), - 'email' => $this->faker->randomNumber(3), + 'email' => $this->faker->email(), 'login' => $this->faker->name(), 'ssoLogin' => $this->faker->userName(), 'notes' => $this->faker->text(), @@ -60,8 +60,8 @@ final class UserDataGenerator extends DataGenerator 'isLdap' => $this->faker->boolean(), 'isMigrate' => $this->faker->boolean(), 'loginCount' => $this->faker->randomNumber(3), - 'lastLogin' => $this->faker->unixTime(), - 'lastUpdate' => $this->faker->unixTime(), + 'lastLogin' => $this->faker->dateTime()->format('Y-m-d H:i:s'), + 'lastUpdate' => $this->faker->dateTime()->format('Y-m-d H:i:s'), 'preferences' => serialize($this->buildUserPreferencesData()), 'pass' => $this->faker->password(), 'hashSalt' => $this->faker->sha1(),