Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 compatibility #232

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": ">=5.7"
},
"support": {
Expand All @@ -58,6 +59,7 @@
]
},
"scripts": {
"test": "php -d xdebug.profiler_enable=on vendor/bin/phpunit --configuration tests/phpunit.xml"
"test": "php -d xdebug.profiler_enable=on vendor/bin/phpunit --configuration tests/phpunit.xml",
"phpstan": "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G"
}
}
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 1
paths:
- src
- tests
phpVersion: 80403 # PHP 8.4.3
treatPhpDocTypesAsCertain: false
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AvaTaxClientBase
*
* @throws \Exception
*/
public function __construct($appName, $appVersion, $machineName="", $environment="", $guzzleParams = [], LoggerInterface $logger = null, $logRequestAndResponseBody = false)
public function __construct($appName, $appVersion, $machineName="", $environment="", $guzzleParams = [], ?LoggerInterface $logger = null, $logRequestAndResponseBody = false)
{
// app name and app version are mandatory fields.
if ($appName == "" || $appName == null || $appVersion == "" || $appVersion == null) {
Expand Down
8 changes: 4 additions & 4 deletions src/Methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,7 @@ public function updateContact($companyId, $id, $model) {
* @return \stdClass
*/
public function bulkUploadCostCenters($companyid, $model=null) {
$path = "/api/v2/companies/{$companyid}/costcenters/$upload";
$path = "/api/v2/companies/{$companyid}/costcenters/upload";
$guzzleParams = [
'query' => [],
'body' => json_encode($model)
Expand Down Expand Up @@ -6072,7 +6072,7 @@ public function fundingRequestStatus($id, $businessUnit=null, $subscriptionType=
* @return \stdClass
*/
public function bulkUploadGLAccounts($companyid, $model=null) {
$path = "/api/v2/companies/{$companyid}/glaccounts/$upload";
$path = "/api/v2/companies/{$companyid}/glaccounts/upload";
$guzzleParams = [
'query' => [],
'body' => json_encode($model)
Expand Down Expand Up @@ -6611,7 +6611,7 @@ public function deleteItemTags($companyId, $itemId) {
* @return \stdClass
*/
public function dismissHSCodeClassificationStatus($companyId, $itemId, $country) {
$path = "/api/v2/companies/{$companyId}/items/{$itemId}/hscode-classifications-status/$dismiss";
$path = "/api/v2/companies/{$companyId}/items/{$itemId}/hscode-classifications-status/dismiss";
$guzzleParams = [
'query' => ['country' => $country],
'body' => null
Expand Down Expand Up @@ -6805,7 +6805,7 @@ public function getPremiumClassification($companyId, $itemCode, $systemCode, $co
* @return \stdClass
*/
public function initiateHSCodeClassification($companyId, $model=null) {
$path = "/api/v2/companies/{$companyId}/items/$initiate-hscode-classification";
$path = "/api/v2/companies/{$companyId}/items/initiate-hscode-classification";
$guzzleParams = [
'query' => [],
'body' => json_encode($model)
Expand Down
4 changes: 2 additions & 2 deletions src/TransactionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public function withLineTaxOverride($type, $reason, $taxAmount, $taxDate)
{
// Address the DateOverride constraint.
if (($type == TaxOverrideType::C_TAXDATE) && (empty($taxDate))) {
throw new Exception("A valid date is required for a Tax Date Tax Override.");
throw new \Exception("A valid date is required for a Tax Date Tax Override.");
}

$li = $this->getMostRecentLineIndex();
Expand Down Expand Up @@ -640,7 +640,7 @@ private function getMostRecentLineIndex()
{
$c = count($this->_model['lines']);
if ($c <= 0) {
throw new \Exception("No lines have been added. The $memberName method applies to the most recent line. To use this function, first add a line.");
throw new \Exception("No lines have been added. The memberName method applies to the most recent line. To use this function, first add a line.");
}

return $c-1;
Expand Down