diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a89f68c..cfc39fb 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -10,7 +10,7 @@ jobs: build: strategy: matrix: - php: ['8.0', '8.1'] + php: ['8.1', '8.2', '8.3'] runs-on: ubuntu-latest steps: @@ -26,7 +26,7 @@ jobs: run: composer install --prefer-dist --no-progress - name: run code php-cs-fixer - run: ./tools/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run + run: PHP_CS_FIXER_IGNORE_ENV=true ./tools/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run - name: run phpstan run: ./tools/phpstan analyse -l 5 ./src diff --git a/composer.json b/composer.json index d550a82..9915c7f 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "require": { "guzzlehttp/guzzle": "^6.0|^7.0", - "php": "^8.0", + "php": "^8.1", "ext-simplexml": "*" }, "require-dev": { diff --git a/docker-compose.yml b/docker-compose.yml index 8d5561b..8958c7f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,8 @@ services: container_name: fastbill_sdk image: dockware/flex:latest ports: - - "22:22" # ssh - - "80:80" # apache2 + - "2222:22" # ssh + - "8088:80" # apache2 volumes: - "sdk_volume:/var/www/html" networks: @@ -14,7 +14,7 @@ services: environment: - XDEBUG_ENABLED=1 - FILEBEAT_ENABLED=0 - - PHP_VERSION=8.0 + - PHP_VERSION=8.2 ## *********************************************************************** diff --git a/examples/contact/create.php b/examples/contact/create.php index 5a382a2..0c53a94 100644 --- a/examples/contact/create.php +++ b/examples/contact/create.php @@ -11,10 +11,10 @@ $customersService = new FastBillSdk\Contact\ContactService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Contact\ContactValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Contact\ContactValidator() ); -$contactEntity = new \FastBillSdk\Contact\ContactEntity(); +$contactEntity = new FastBillSdk\Contact\ContactEntity(); $contactEntity->customerId = 123123123; $contactEntity->firstName = 'Max'; $contactEntity->lastName = 'Mustermann'; diff --git a/examples/contact/delete.php b/examples/contact/delete.php index 55c63e4..6d7bf22 100644 --- a/examples/contact/delete.php +++ b/examples/contact/delete.php @@ -11,10 +11,10 @@ $customersService = new FastBillSdk\Contact\ContactService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Contact\ContactValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Contact\ContactValidator() ); -$contactEntity = new \FastBillSdk\Contact\ContactEntity(); +$contactEntity = new FastBillSdk\Contact\ContactEntity(); $contactEntity->contactId = 112233; $result = $customersService->deleteContact($contactEntity); diff --git a/examples/contact/get.php b/examples/contact/get.php index c75356f..4896a50 100644 --- a/examples/contact/get.php +++ b/examples/contact/get.php @@ -11,10 +11,10 @@ $customersService = new FastBillSdk\Contact\ContactService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Contact\ContactValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Contact\ContactValidator() ); -$customersSearchStruct = new \FastBillSdk\Contact\ContactSearchStruct(); +$customersSearchStruct = new FastBillSdk\Contact\ContactSearchStruct(); $customersSearchStruct->setCustomerIdFilter(123123123); $result = $customersService->getContact($customersSearchStruct); diff --git a/examples/contact/update.php b/examples/contact/update.php index 397fc45..67557a6 100644 --- a/examples/contact/update.php +++ b/examples/contact/update.php @@ -11,10 +11,10 @@ $customersService = new FastBillSdk\Contact\ContactService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Contact\ContactValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Contact\ContactValidator() ); -$contactEntity = new \FastBillSdk\Contact\ContactEntity(); +$contactEntity = new FastBillSdk\Contact\ContactEntity(); $contactEntity->contactId = 112233; $contactEntity->firstName = 'Max'; $contactEntity->lastName = 'Musterfrau'; diff --git a/examples/customer/create.php b/examples/customer/create.php index 6d1947f..be0beb0 100644 --- a/examples/customer/create.php +++ b/examples/customer/create.php @@ -11,12 +11,12 @@ $customersService = new FastBillSdk\Customer\CustomerService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Customer\CustomerValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Customer\CustomerValidator() ); -$customersEntity = new \FastBillSdk\Customer\CustomerEntity(); -$customersEntity->customerType = \FastBillSdk\Customer\CustomerEntity::CUSTOMER_TYPE_CONSUMER; +$customersEntity = new FastBillSdk\Customer\CustomerEntity(); +$customersEntity->customerType = FastBillSdk\Customer\CustomerEntity::CUSTOMER_TYPE_CONSUMER; $customersEntity->firstName = 'FirstName'; $customersEntity->lastName = 'LastName'; $result = $customersService->createCustomer($customersEntity); diff --git a/examples/customer/delete.php b/examples/customer/delete.php index 3a4f6f4..35b06d1 100644 --- a/examples/customer/delete.php +++ b/examples/customer/delete.php @@ -11,11 +11,11 @@ $customersService = new FastBillSdk\Customer\CustomerService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Customer\CustomerValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Customer\CustomerValidator() ); -$customersEntity = new \FastBillSdk\Customer\CustomerEntity(); +$customersEntity = new FastBillSdk\Customer\CustomerEntity(); $customersEntity->customerId = 1111; $result = $customersService->deleteCustomer($customersEntity); diff --git a/examples/customer/get.php b/examples/customer/get.php index 95d3b22..3f88f66 100644 --- a/examples/customer/get.php +++ b/examples/customer/get.php @@ -11,10 +11,10 @@ $customersService = new FastBillSdk\Customer\CustomerService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Customer\CustomerValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Customer\CustomerValidator() ); -$customersSearchStruct = new \FastBillSdk\Customer\CustomerSearchStruct(); +$customersSearchStruct = new FastBillSdk\Customer\CustomerSearchStruct(); $customersSearchStruct->setCustomerIdFilter(123123123); $result = $customersService->getCustomer($customersSearchStruct); diff --git a/examples/customer/update.php b/examples/customer/update.php index 871d2c0..d8acec8 100644 --- a/examples/customer/update.php +++ b/examples/customer/update.php @@ -11,12 +11,12 @@ $customersService = new FastBillSdk\Customer\CustomerService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Customer\CustomerValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Customer\CustomerValidator() ); -$customersEntity = new \FastBillSdk\Customer\CustomerEntity(); -$customersEntity->customerType = \FastBillSdk\Customer\CustomerEntity::CUSTOMER_TYPE_CONSUMER; +$customersEntity = new FastBillSdk\Customer\CustomerEntity(); +$customersEntity->customerType = FastBillSdk\Customer\CustomerEntity::CUSTOMER_TYPE_CONSUMER; $customersEntity->customerId = 1111; $customersEntity->firstName = 'FirstName v2'; $customersEntity->lastName = 'LastName v2'; diff --git a/examples/estimate/create.php b/examples/estimate/create.php index 5d48ec0..d2d3a34 100644 --- a/examples/estimate/create.php +++ b/examples/estimate/create.php @@ -11,14 +11,14 @@ $estimateService = new FastBillSdk\Estimate\EstimateService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Estimate\EstimateValidator( - new \FastBillSdk\Estimate\EstimateItemValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Estimate\EstimateValidator( + new FastBillSdk\Estimate\EstimateItemValidator() ) ); -$estimateEntity = new \FastBillSdk\Estimate\EstimateEntity(); +$estimateEntity = new FastBillSdk\Estimate\EstimateEntity(); $estimateEntity->customerId = 123123123; -$estimateItemEntity = new \FastBillSdk\Estimate\EstimateItemEntity(); +$estimateItemEntity = new FastBillSdk\Estimate\EstimateItemEntity(); $estimateItemEntity->description = 'FastBill SDK'; $estimateItemEntity->unitPrice = '1337'; $estimateItemEntity->vatPercent = '19'; diff --git a/examples/estimate/createinvoice.php b/examples/estimate/createinvoice.php index c1d8d22..1254ce4 100644 --- a/examples/estimate/createinvoice.php +++ b/examples/estimate/createinvoice.php @@ -11,13 +11,13 @@ $estimateService = new FastBillSdk\Estimate\EstimateService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Estimate\EstimateValidator( - new \FastBillSdk\Estimate\EstimateItemValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Estimate\EstimateValidator( + new FastBillSdk\Estimate\EstimateItemValidator() ) ); -$estimateEntity = new \FastBillSdk\Estimate\EstimateEntity(); +$estimateEntity = new FastBillSdk\Estimate\EstimateEntity(); $estimateEntity->estimateId = 16343450; $result = $estimateService->createInvoiceFromEstimate($estimateEntity); diff --git a/examples/estimate/delete.php b/examples/estimate/delete.php index 87eef32..3a9fe2a 100644 --- a/examples/estimate/delete.php +++ b/examples/estimate/delete.php @@ -11,12 +11,12 @@ $estimateService = new FastBillSdk\Estimate\EstimateService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Estimate\EstimateValidator( - new \FastBillSdk\Estimate\EstimateItemValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Estimate\EstimateValidator( + new FastBillSdk\Estimate\EstimateItemValidator() ) ); -$estimateEntity = new \FastBillSdk\Estimate\EstimateEntity(); +$estimateEntity = new FastBillSdk\Estimate\EstimateEntity(); $estimateEntity->estimateId = '16343462'; $result = $estimateService->deleteEstimate($estimateEntity); diff --git a/examples/estimate/get.php b/examples/estimate/get.php index c7fd0dd..b75530d 100644 --- a/examples/estimate/get.php +++ b/examples/estimate/get.php @@ -11,12 +11,12 @@ $estimateService = new FastBillSdk\Estimate\EstimateService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Estimate\EstimateValidator( - new \FastBillSdk\Estimate\EstimateItemValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Estimate\EstimateValidator( + new FastBillSdk\Estimate\EstimateItemValidator() ) ); -$estimateSearchStruct = new \FastBillSdk\Estimate\EstimateSearchStruct(); +$estimateSearchStruct = new FastBillSdk\Estimate\EstimateSearchStruct(); $result = $estimateService->getEstimate($estimateSearchStruct); ini_set('xdebug.var_display_max_depth', '5'); diff --git a/examples/estimate/sendbyemail.php b/examples/estimate/sendbyemail.php index 9dcdb0a..31b3e59 100644 --- a/examples/estimate/sendbyemail.php +++ b/examples/estimate/sendbyemail.php @@ -11,13 +11,13 @@ $estimateService = new FastBillSdk\Estimate\EstimateService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Estimate\EstimateValidator( - new \FastBillSdk\Estimate\EstimateItemValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Estimate\EstimateValidator( + new FastBillSdk\Estimate\EstimateItemValidator() ) ); $estimateId = 16343450; -$recipient = new \FastBillSdk\Common\RecipientEntity(); +$recipient = new FastBillSdk\Common\RecipientEntity(); $recipient->setToEmailAddress('test@example.com'); $subject = 'Estimate Subject'; diff --git a/examples/generator.php b/examples/generator.php index 8b3ba36..eccdda0 100644 --- a/examples/generator.php +++ b/examples/generator.php @@ -29,7 +29,7 @@ function lowerCamelCase($string) VAT_VALUE'; foreach (explode("\n", $fields) as $value) { - echo 'public $' . lowerCamelCase($value) . ';' . '

'; + echo 'public $' . lowerCamelCase($value) . ';

'; } echo ' const FIELD_MAPPING = [
'; @@ -39,7 +39,7 @@ function lowerCamelCase($string) echo '];

'; echo ' const XML_FIELD_MAPPING = [
'; -foreach (\FastBillSdk\Invoice\InvoiceEntity::FIELD_MAPPING as $key => $value) { +foreach (FastBillSdk\Invoice\InvoiceEntity::FIELD_MAPPING as $key => $value) { echo '\'' . $value . '\' => \'' . $key . '\',
'; } echo '];

'; diff --git a/examples/product/create.php b/examples/product/create.php index ca34b02..d53cefe 100644 --- a/examples/product/create.php +++ b/examples/product/create.php @@ -11,11 +11,11 @@ $productService = new FastBillSdk\Product\ProductService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Product\ProductValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Product\ProductValidator() ); -$entity = new \FastBillSdk\Product\ProductEntity(); +$entity = new FastBillSdk\Product\ProductEntity(); $entity->title = 'FastBill SDK'; $entity->unitPrice = 1337; $entity->articleNumber = 222; diff --git a/examples/product/delete.php b/examples/product/delete.php index abd6b3f..bdb97c5 100644 --- a/examples/product/delete.php +++ b/examples/product/delete.php @@ -11,11 +11,11 @@ $productService = new FastBillSdk\Product\ProductService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Product\ProductValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Product\ProductValidator() ); -$entity = new \FastBillSdk\Product\ProductEntity(); +$entity = new FastBillSdk\Product\ProductEntity(); $entity->articleId = 3493981; $result = $productService->deleteProduct($entity); diff --git a/examples/product/get.php b/examples/product/get.php index a4d04d9..9155b20 100644 --- a/examples/product/get.php +++ b/examples/product/get.php @@ -11,11 +11,11 @@ $productService = new FastBillSdk\Product\ProductService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Product\ProductValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Product\ProductValidator() ); -$result = $productService->getProducts(new \FastBillSdk\Product\ProductSearchStruct()); +$result = $productService->getProducts(new FastBillSdk\Product\ProductSearchStruct()); ini_set('xdebug.var_display_max_depth', '5'); ini_set('xdebug.var_display_max_children', '256'); diff --git a/examples/product/update.php b/examples/product/update.php index c1c47ce..6ba520f 100644 --- a/examples/product/update.php +++ b/examples/product/update.php @@ -11,11 +11,11 @@ $productService = new FastBillSdk\Product\ProductService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\Product\ProductValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\Product\ProductValidator() ); -$entity = new \FastBillSdk\Product\ProductEntity(); +$entity = new FastBillSdk\Product\ProductEntity(); $entity->articleId = 3493981; $entity->articleNumber = 42; $entity->title = 'FastBill SDK v2'; diff --git a/examples/template.get.php b/examples/template.get.php index b118ce0..9cf7489 100644 --- a/examples/template.get.php +++ b/examples/template.get.php @@ -11,7 +11,7 @@ $templatesService = new FastBillSdk\Template\TemplateService( $fastBillClient, - new \FastBillSdk\Common\XmlService() + new FastBillSdk\Common\XmlService() ); $result = $templatesService->getTemplate(); diff --git a/examples/worktime/create.php b/examples/worktime/create.php index 735090d..719c0fe 100644 --- a/examples/worktime/create.php +++ b/examples/worktime/create.php @@ -11,11 +11,11 @@ $workTimesService = new FastBillSdk\WorkTime\WorkTimeService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\WorkTime\WorkTimeValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\WorkTime\WorkTimeValidator() ); -$workTimeEntity = new \FastBillSdk\WorkTime\WorkTimeEntity(); +$workTimeEntity = new FastBillSdk\WorkTime\WorkTimeEntity(); $workTimeEntity->customerId = 123; $workTimeEntity->projectId = 456; $workTimeEntity->comment = 'sdk test'; diff --git a/examples/worktime/delete.php b/examples/worktime/delete.php index c7394b8..2ff1e37 100644 --- a/examples/worktime/delete.php +++ b/examples/worktime/delete.php @@ -11,11 +11,11 @@ $workTimesService = new FastBillSdk\WorkTime\WorkTimeService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\WorkTime\WorkTimeValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\WorkTime\WorkTimeValidator() ); -$workTimeEntity = new \FastBillSdk\WorkTime\WorkTimeEntity(); +$workTimeEntity = new FastBillSdk\WorkTime\WorkTimeEntity(); $workTimeEntity->timeId = 991936; $result = $workTimesService->deleteTime($workTimeEntity); diff --git a/examples/worktime/get.php b/examples/worktime/get.php index ca34029..f5dee08 100644 --- a/examples/worktime/get.php +++ b/examples/worktime/get.php @@ -11,10 +11,10 @@ $workTimesService = new FastBillSdk\WorkTime\WorkTimeService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\WorkTime\WorkTimeValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\WorkTime\WorkTimeValidator() ); -$workTimesSearchStruct = new \FastBillSdk\WorkTime\WorkTimeSearchStruct(); +$workTimesSearchStruct = new FastBillSdk\WorkTime\WorkTimeSearchStruct(); // $workTimesSearchStruct->setCustomerIdFilter(123123); $result = $workTimesService->getTime($workTimesSearchStruct); diff --git a/examples/worktime/update.php b/examples/worktime/update.php index 5cb1e6a..c195209 100644 --- a/examples/worktime/update.php +++ b/examples/worktime/update.php @@ -11,11 +11,11 @@ $workTimesService = new FastBillSdk\WorkTime\WorkTimeService( $fastBillClient, - new \FastBillSdk\Common\XmlService(), - new \FastBillSdk\WorkTime\WorkTimeValidator() + new FastBillSdk\Common\XmlService(), + new FastBillSdk\WorkTime\WorkTimeValidator() ); -$workTimeEntity = new \FastBillSdk\WorkTime\WorkTimeEntity(); +$workTimeEntity = new FastBillSdk\WorkTime\WorkTimeEntity(); $workTimeEntity->timeId = 991936; $workTimeEntity->customerId = 123; $workTimeEntity->projectId = 456; diff --git a/phive.xml b/phive.xml index 200b767..bf2c900 100644 --- a/phive.xml +++ b/phive.xml @@ -1,5 +1,5 @@ - - + + diff --git a/src/Contact/ContactEntity.php b/src/Contact/ContactEntity.php index a454253..1367eea 100644 --- a/src/Contact/ContactEntity.php +++ b/src/Contact/ContactEntity.php @@ -115,7 +115,7 @@ class ContactEntity 'comment' => 'COMMENT', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Customer/CustomerEntity.php b/src/Customer/CustomerEntity.php index e3fdf1f..fa5074f 100644 --- a/src/Customer/CustomerEntity.php +++ b/src/Customer/CustomerEntity.php @@ -179,7 +179,7 @@ class CustomerEntity 'documentHistoryUrl' => 'DOCUMENT_HISTORY_URL', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Document/DocumentEntity.php b/src/Document/DocumentEntity.php index a799449..ccf2db2 100644 --- a/src/Document/DocumentEntity.php +++ b/src/Document/DocumentEntity.php @@ -31,7 +31,7 @@ class DocumentEntity 'note' => 'NOTE', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Estimate/EstimateEntity.php b/src/Estimate/EstimateEntity.php index c1a945f..fe5a276 100644 --- a/src/Estimate/EstimateEntity.php +++ b/src/Estimate/EstimateEntity.php @@ -161,7 +161,7 @@ class EstimateEntity 'documentUrl' => 'DOCUMENT_URL', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $items = []; diff --git a/src/Estimate/EstimateItemEntity.php b/src/Estimate/EstimateItemEntity.php index 335dbfc..3470d2a 100644 --- a/src/Estimate/EstimateItemEntity.php +++ b/src/Estimate/EstimateItemEntity.php @@ -55,7 +55,7 @@ class EstimateItemEntity 'sortOrder' => 'SORT_ORDER', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Estimate/EstimateService.php b/src/Estimate/EstimateService.php index 99569b3..fe639ed 100644 --- a/src/Estimate/EstimateService.php +++ b/src/Estimate/EstimateService.php @@ -86,9 +86,9 @@ public function createInvoiceFromEstimate(EstimateEntity $entity): int public function sendEstimateByEmail( int $estimateId, RecipientEntity $recipient, - string $subject = null, - string $message = null, - bool $receiptConfirmation = null + ?string $subject = null, + ?string $message = null, + ?bool $receiptConfirmation = null ): string { $this->xmlService->setService('estimate.sendbyemail'); $data['ESTIMATE_ID'] = $estimateId; diff --git a/src/Estimate/EstimateVatItemEntity.php b/src/Estimate/EstimateVatItemEntity.php index f2b2a8d..c480c2e 100644 --- a/src/Estimate/EstimateVatItemEntity.php +++ b/src/Estimate/EstimateVatItemEntity.php @@ -23,7 +23,7 @@ class EstimateVatItemEntity 'vatValue' => 'VAT_VALUE', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Expense/ExpenseEntity.php b/src/Expense/ExpenseEntity.php index 281df9b..f697f8a 100644 --- a/src/Expense/ExpenseEntity.php +++ b/src/Expense/ExpenseEntity.php @@ -95,7 +95,7 @@ class ExpenseEntity 'servicePeriodEnd' => 'SERVICE_PERIOD_END', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/ExpenseItem/ExpenseItemEntity.php b/src/ExpenseItem/ExpenseItemEntity.php index f50bd42..90a50eb 100644 --- a/src/ExpenseItem/ExpenseItemEntity.php +++ b/src/ExpenseItem/ExpenseItemEntity.php @@ -73,7 +73,7 @@ class ExpenseItemEntity 'sortOrder' => 'SORT_ORDER', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/ExpenseItem/ExpenseVatItemEntity.php b/src/ExpenseItem/ExpenseVatItemEntity.php index e7bf918..f411694 100644 --- a/src/ExpenseItem/ExpenseVatItemEntity.php +++ b/src/ExpenseItem/ExpenseVatItemEntity.php @@ -23,7 +23,7 @@ class ExpenseVatItemEntity 'vatValue' => 'VAT_VALUE', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Invoice/InvoiceCommentEntity.php b/src/Invoice/InvoiceCommentEntity.php index d1671ed..0d12194 100644 --- a/src/Invoice/InvoiceCommentEntity.php +++ b/src/Invoice/InvoiceCommentEntity.php @@ -17,7 +17,7 @@ class InvoiceCommentEntity 'COMMENT_PUBLIC' => 'commentPublic', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Invoice/InvoiceEntity.php b/src/Invoice/InvoiceEntity.php index 233510a..72dd1eb 100644 --- a/src/Invoice/InvoiceEntity.php +++ b/src/Invoice/InvoiceEntity.php @@ -128,6 +128,10 @@ class InvoiceEntity public $documentUrl; + public $startDate; + + public $endDate; + public const FIELD_MAPPING = [ 'INVOICE_ID' => 'invoiceId', 'TYPE' => 'type', @@ -183,6 +187,8 @@ class InvoiceEntity 'PAYMENTS' => 'payments', 'PAYMENT_INFO' => 'paymentInfo', 'DOCUMENT_URL' => 'documentUrl', + 'START_DATE' => 'startDate', + 'END_DATE' => 'endDate', ]; public const XML_FIELD_MAPPING = [ @@ -240,9 +246,11 @@ class InvoiceEntity 'payments' => 'PAYMENTS', 'paymentInfo' => 'PAYMENT_INFO', 'documentUrl' => 'DOCUMENT_URL', + 'startDate' => 'START_DATE', + 'endDate' => 'END_DATE', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Invoice/InvoicePaymentEntity.php b/src/Invoice/InvoicePaymentEntity.php index 83410a9..9c4a2a3 100644 --- a/src/Invoice/InvoicePaymentEntity.php +++ b/src/Invoice/InvoicePaymentEntity.php @@ -29,7 +29,7 @@ class InvoicePaymentEntity 'NOTE' => 'note', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Invoice/InvoiceService.php b/src/Invoice/InvoiceService.php index 5a3c1fd..d1e8766 100644 --- a/src/Invoice/InvoiceService.php +++ b/src/Invoice/InvoiceService.php @@ -131,8 +131,8 @@ public function cancelInvoice(InvoiceEntity $entity): InvoiceEntity public function sendByEmailInvoice( InvoiceEntity $entity, RecipientEntity $recipient, - string $subject = null, - string $message = null, + ?string $subject = null, + ?string $message = null, bool $receiptConfirmation = false ): string { $this->xmlService->setService('invoice.sendbyemail'); diff --git a/src/Item/ItemEntity.php b/src/Item/ItemEntity.php index 8352ae3..a8dadae 100644 --- a/src/Item/ItemEntity.php +++ b/src/Item/ItemEntity.php @@ -71,7 +71,7 @@ class ItemEntity 'sortOrder' => 'SORT_ORDER', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Item/VatItemEntity.php b/src/Item/VatItemEntity.php index 0495d05..e460e41 100644 --- a/src/Item/VatItemEntity.php +++ b/src/Item/VatItemEntity.php @@ -23,7 +23,7 @@ class VatItemEntity 'vatValue' => 'VAT_VALUE', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Product/ProductEntity.php b/src/Product/ProductEntity.php index 1c62725..7ae2228 100644 --- a/src/Product/ProductEntity.php +++ b/src/Product/ProductEntity.php @@ -51,7 +51,7 @@ class ProductEntity 'tags' => 'TAGS', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Project/ProjectEntity.php b/src/Project/ProjectEntity.php index 06c169e..9763c31 100644 --- a/src/Project/ProjectEntity.php +++ b/src/Project/ProjectEntity.php @@ -55,7 +55,7 @@ class ProjectEntity 'tasks' => 'TASKS', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/RecurringInvoice/RecurringInvoiceEntity.php b/src/RecurringInvoice/RecurringInvoiceEntity.php index 8e0b2b6..de4aacb 100644 --- a/src/RecurringInvoice/RecurringInvoiceEntity.php +++ b/src/RecurringInvoice/RecurringInvoiceEntity.php @@ -104,7 +104,7 @@ class RecurringInvoiceEntity 'deleteExistingItems' => 'DELETE_EXISTING_ITEMS', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Revenue/RevenueEntity.php b/src/Revenue/RevenueEntity.php index 72ff766..0f954cf 100644 --- a/src/Revenue/RevenueEntity.php +++ b/src/Revenue/RevenueEntity.php @@ -187,7 +187,7 @@ class RevenueEntity 'documentUrl' => 'DOCUMENT_URL', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/Template/TemplateEntity.php b/src/Template/TemplateEntity.php index f9db558..260bf52 100644 --- a/src/Template/TemplateEntity.php +++ b/src/Template/TemplateEntity.php @@ -17,7 +17,7 @@ class TemplateEntity 'TEMPLATE_HASH' => 'templateHash', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/src/WorkTime/WorkTimeEntity.php b/src/WorkTime/WorkTimeEntity.php index 6d23ac1..4ec32d2 100644 --- a/src/WorkTime/WorkTimeEntity.php +++ b/src/WorkTime/WorkTimeEntity.php @@ -51,7 +51,7 @@ class WorkTimeEntity 'comment' => 'COMMENT', ]; - public function __construct(\SimpleXMLElement $data = null) + public function __construct(?\SimpleXMLElement $data = null) { if ($data) { $this->setData($data); diff --git a/tests/Helper/ApiDummyResponse.php b/tests/Helper/ApiDummyResponse.php index 28099b8..74adbd6 100644 --- a/tests/Helper/ApiDummyResponse.php +++ b/tests/Helper/ApiDummyResponse.php @@ -3,6 +3,7 @@ namespace FastBillSdkTest\Helper; +use Psr\Http\Message\MessageInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -18,60 +19,73 @@ public function __construct(string $responseXml) $this->responseXml = $responseXml; } - public function getStatusCode() + public function getProtocolVersion(): string { + // TODO: Implement getProtocolVersion() method. } - public function withStatus($code, $reasonPhrase = '') + public function withProtocolVersion(string $version): MessageInterface { + // TODO: Implement withProtocolVersion() method. } - public function getReasonPhrase() + public function getHeaders(): array { + // TODO: Implement getHeaders() method. } - public function getProtocolVersion() + public function hasHeader(string $name): bool { + // TODO: Implement hasHeader() method. } - public function withProtocolVersion($version) + public function getHeader(string $name): array { + // TODO: Implement getHeader() method. } - public function getHeaders() + public function getHeaderLine(string $name): string { + // TODO: Implement getHeaderLine() method. } - public function hasHeader($name) + public function withHeader(string $name, $value): MessageInterface { + // TODO: Implement withHeader() method. } - public function getHeader($name) + public function withAddedHeader(string $name, $value): MessageInterface { + // TODO: Implement withAddedHeader() method. } - public function getHeaderLine($name) + public function withoutHeader(string $name): MessageInterface { + // TODO: Implement withoutHeader() method. } - public function withHeader($name, $value) + public function getBody(): StreamInterface { + // TODO: Implement getBody() method. } - public function withAddedHeader($name, $value) + public function withBody(StreamInterface $body): MessageInterface { + // TODO: Implement withBody() method. } - public function withoutHeader($name) + public function getStatusCode(): int { + // TODO: Implement getStatusCode() method. } - public function getBody() + public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface { - return $this->responseXml; + // TODO: Implement withStatus() method. } - public function withBody(StreamInterface $body) + public function getReasonPhrase(): string { + return ''; } } diff --git a/tools/php-cs-fixer b/tools/php-cs-fixer index 4ccc63b..cbbbe58 100755 Binary files a/tools/php-cs-fixer and b/tools/php-cs-fixer differ diff --git a/tools/phpstan b/tools/phpstan index ad73bb7..b2d1aa4 100755 Binary files a/tools/phpstan and b/tools/phpstan differ