Skip to content

Commit e78b942

Browse files
driesvintsgithub-actions[bot]
authored andcommitted
Fix code styling
1 parent 812e279 commit e78b942

File tree

4 files changed

+31
-33
lines changed

4 files changed

+31
-33
lines changed

src/Exceptions/VATCheckUnavailableException.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
use Exception;
66

7-
class VATCheckUnavailableException extends Exception
8-
{
9-
}
7+
class VATCheckUnavailableException extends Exception {}

tests/Rules/ValidVatNumberTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testValidatesUnavailableVATNumberCheck()
6565
VatCalculator::shouldReceive('isValidVATNumber')
6666
->with($vatNumber)
6767
->once()
68-
->andThrow(new VATCheckUnavailableException());
68+
->andThrow(new VATCheckUnavailableException);
6969

7070
$validator = Validator::make(
7171
['vat_number' => $vatNumber],
@@ -82,7 +82,7 @@ public function testDefaultErrorMessageWorks()
8282
VatCalculator::shouldReceive('isValidVATNumber')
8383
->with($vatNumber)
8484
->once()
85-
->andThrow(new VATCheckUnavailableException());
85+
->andThrow(new VATCheckUnavailableException);
8686

8787
$validator = Validator::make(
8888
['vat_number' => $vatNumber],

tests/Traits/BillableWithinTheEUTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testTaxPercentZeroByDefault()
2929
->with(null, false)
3030
->andReturn(0);
3131

32-
$billable = new BillableWithinTheEUTestStub();
32+
$billable = new BillableWithinTheEUTestStub;
3333
$taxPercent = $billable->getTaxPercent();
3434
$this->assertEquals(0, $taxPercent);
3535
}
@@ -44,7 +44,7 @@ public function testTaxPercentGetsCalculated()
4444
->with($countryCode, $company)
4545
->andReturn(0.19);
4646

47-
$billable = new BillableWithinTheEUTestStub();
47+
$billable = new BillableWithinTheEUTestStub;
4848
$billable->setTaxForCountry($countryCode, $company);
4949
$taxPercent = $billable->getTaxPercent();
5050
$this->assertEquals(19, $taxPercent);
@@ -59,7 +59,7 @@ public function testTaxPercentGetsCalculatedByUseTaxFrom()
5959
->with($countryCode, $company)
6060
->andReturn(0.19);
6161

62-
$billable = new BillableWithinTheEUTestStub();
62+
$billable = new BillableWithinTheEUTestStub;
6363
$billable->useTaxFrom($countryCode);
6464
$taxPercent = $billable->getTaxPercent();
6565
$this->assertEquals(19, $taxPercent);
@@ -74,7 +74,7 @@ public function testTaxPercentGetsCalculatedByUseTaxFromAsBusinessCustomer()
7474
->with($countryCode, $company)
7575
->andReturn(0);
7676

77-
$billable = new BillableWithinTheEUTestStub();
77+
$billable = new BillableWithinTheEUTestStub;
7878
$billable->useTaxFrom($countryCode)->asBusiness();
7979
$taxPercent = $billable->getTaxPercent();
8080
$this->assertEquals(0, $taxPercent);
@@ -90,7 +90,7 @@ public function testTaxPercentGetsCalculatedByUseTaxFromAsIndividual()
9090
->with($countryCode, $company)
9191
->andReturn(0.19);
9292

93-
$billable = new BillableWithinTheEUTestStub();
93+
$billable = new BillableWithinTheEUTestStub;
9494
$billable->useTaxFrom($countryCode)->asIndividual();
9595
$taxPercent = $billable->getTaxPercent();
9696
$this->assertEquals(19, $taxPercent);

tests/VatCalculatorTest.php

+23-23
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testCalculateVatWithoutCountryAndConfig()
3939
{
4040
$net = 25.00;
4141

42-
$vatCalculator = new VatCalculator();
42+
$vatCalculator = new VatCalculator;
4343
$result = $vatCalculator->calculate($net);
4444
$this->assertEquals(25.00, $result);
4545
}
@@ -74,7 +74,7 @@ public function testCalculateVatWithPredefinedRulesWithoutConfig()
7474
$net = 24.00;
7575
$countryCode = 'DE';
7676

77-
$vatCalculator = new VatCalculator();
77+
$vatCalculator = new VatCalculator;
7878
$result = $vatCalculator->calculate($net, $countryCode);
7979
$this->assertEquals(28.56, $result);
8080
$this->assertEquals(0.19, $vatCalculator->getTaxRate());
@@ -132,7 +132,7 @@ public function testCalculatVatWithCountryDirectSetWithoutConfiguration()
132132
$net = 24.00;
133133
$countryCode = 'DE';
134134

135-
$vatCalculator = new VatCalculator();
135+
$vatCalculator = new VatCalculator;
136136
$result = $vatCalculator->calculate($net, $countryCode);
137137
$this->assertEquals(28.56, $result);
138138
$this->assertEquals(0.19, $vatCalculator->getTaxRate());
@@ -303,7 +303,7 @@ public function testCanValidateValidVATNumber()
303303
->with('vat_calculator', [])
304304
->andReturn([]);
305305

306-
$result = new \stdClass();
306+
$result = new \stdClass;
307307
$result->valid = true;
308308

309309
$vatCheck = $this->getMockFromWsdl(__DIR__.'/checkVatService.wsdl', 'VATService');
@@ -324,7 +324,7 @@ public function testCanValidateValidVATNumber()
324324

325325
public function testCanValidateInvalidVATNumber()
326326
{
327-
$result = new \stdClass();
327+
$result = new \stdClass;
328328
$result->valid = false;
329329

330330
$vatCheck = $this->getMockFromWsdl(__DIR__.'/checkVatService.wsdl', 'VATService');
@@ -337,7 +337,7 @@ public function testCanValidateInvalidVATNumber()
337337
->willReturn($result);
338338

339339
$vatNumber = 'SomeInvalidNumber';
340-
$vatCalculator = new VatCalculator();
340+
$vatCalculator = new VatCalculator;
341341
$vatCalculator->setSoapClient($vatCheck);
342342
$result = $vatCalculator->isValidVATNumber($vatNumber);
343343
$this->assertFalse($result);
@@ -355,7 +355,7 @@ public function testValidateVATNumberReturnsFalseOnSoapFailure()
355355
->willThrowException(new \SoapFault('Server', 'Something went wrong'));
356356

357357
$vatNumber = 'SomeInvalidNumber';
358-
$vatCalculator = new VatCalculator();
358+
$vatCalculator = new VatCalculator;
359359
$vatCalculator->setSoapClient($vatCheck);
360360
$result = $vatCalculator->isValidVATNumber($vatNumber);
361361
$this->assertFalse($result);
@@ -414,11 +414,11 @@ public function testCannotValidateVATNumberWhenServiceIsDown()
414414
{
415415
$this->expectException(VATCheckUnavailableException::class);
416416

417-
$result = new \stdClass();
417+
$result = new \stdClass;
418418
$result->valid = false;
419419

420420
$vatNumber = 'SomeInvalidNumber';
421-
$vatCalculator = new VatCalculator();
421+
$vatCalculator = new VatCalculator;
422422
$vatCalculator->setSoapClient(false);
423423
$vatCalculator->isValidVATNumber($vatNumber);
424424
}
@@ -431,7 +431,7 @@ public function testCanValidateValidUKVATNumber()
431431
->with('vat_calculator', [])
432432
->andReturn([]);
433433

434-
$result = new \stdClass();
434+
$result = new \stdClass;
435435
$result->valid = true;
436436

437437
$vatNumber = 'GB 553557881';
@@ -448,7 +448,7 @@ public function testCanValidateInvalidUKVATNumber()
448448
->with('vat_calculator', [])
449449
->andReturn([]);
450450

451-
$result = new \stdClass();
451+
$result = new \stdClass;
452452
$result->valid = true;
453453

454454
$vatNumber = 'GB Invalid';
@@ -480,7 +480,7 @@ public function testCompanyInBusinessCountryGetsValidVATRateDirectSet()
480480
$net = 24.00;
481481
$countryCode = 'DE';
482482

483-
$vatCalculator = new VatCalculator();
483+
$vatCalculator = new VatCalculator;
484484
$vatCalculator->setBusinessCountryCode('DE');
485485
$result = $vatCalculator->calculate($net, $countryCode, null, true);
486486
$this->assertEquals(28.56, $result);
@@ -493,7 +493,7 @@ public function testCompanyOutsideBusinessCountryGetsValidVATRate()
493493
$net = 24.00;
494494
$countryCode = 'DE';
495495

496-
$vatCalculator = new VatCalculator();
496+
$vatCalculator = new VatCalculator;
497497
$vatCalculator->setBusinessCountryCode('NL');
498498
$result = $vatCalculator->calculate($net, $countryCode, null, true);
499499
$this->assertEquals(24.00, $result);
@@ -506,7 +506,7 @@ public function testReturnsZeroForInvalidCountryCode()
506506
$net = 24.00;
507507
$countryCode = 'XXX';
508508

509-
$vatCalculator = new VatCalculator();
509+
$vatCalculator = new VatCalculator;
510510
$result = $vatCalculator->calculate($net, $countryCode, null, true);
511511
$this->assertEquals(24.00, $result);
512512
$this->assertEquals(0.00, $vatCalculator->getTaxRate());
@@ -516,7 +516,7 @@ public function testReturnsZeroForInvalidCountryCode()
516516
public function testChecksPostalCodeForVATExceptions()
517517
{
518518
$net = 24.00;
519-
$vatCalculator = new VatCalculator();
519+
$vatCalculator = new VatCalculator;
520520
$postalCode = '27498'; // Heligoland
521521
$result = $vatCalculator->calculate($net, 'DE', $postalCode, false);
522522
$this->assertEquals(24.00, $result);
@@ -551,7 +551,7 @@ public function testChecksPostalCodeForVATExceptions()
551551
public function testPostalCodesWithoutExceptionsGetStandardRate()
552552
{
553553
$net = 24.00;
554-
$vatCalculator = new VatCalculator();
554+
$vatCalculator = new VatCalculator;
555555

556556
// Invalid post code
557557
$postalCode = 'IGHJ987ERT35';
@@ -602,7 +602,7 @@ public function testPostalCodesWithoutExceptionsOverwrittenByConfiguration()
602602

603603
public function testShouldCollectVAT()
604604
{
605-
$vatCalculator = new VatCalculator();
605+
$vatCalculator = new VatCalculator;
606606
$this->assertTrue($vatCalculator->shouldCollectVAT('DE'));
607607
$this->assertTrue($vatCalculator->shouldCollectVAT('NL'));
608608
$this->assertFalse($vatCalculator->shouldCollectVAT(''));
@@ -647,7 +647,7 @@ public function testCalculateNetPriceWithoutCountryAndConfig()
647647
{
648648
$gross = 25.00;
649649

650-
$vatCalculator = new VatCalculator();
650+
$vatCalculator = new VatCalculator;
651651
$result = $vatCalculator->calculateNet($gross);
652652
$this->assertEquals(25.00, $result);
653653
}
@@ -675,7 +675,7 @@ public function testCalculateNetPriceWithPredefinedRulesWithoutConfig()
675675
$gross = 28.56;
676676
$countryCode = 'DE';
677677

678-
$vatCalculator = new VatCalculator();
678+
$vatCalculator = new VatCalculator;
679679
$result = $vatCalculator->calculateNet($gross, $countryCode);
680680
$this->assertEquals(24.00, $result);
681681
$this->assertEquals(0.19, $vatCalculator->getTaxRate());
@@ -733,7 +733,7 @@ public function testCalculateNetPriceWithCountryDirectSetWithoutConfiguration()
733733
$gross = 28.56;
734734
$countryCode = 'DE';
735735

736-
$vatCalculator = new VatCalculator();
736+
$vatCalculator = new VatCalculator;
737737

738738
$result = $vatCalculator->calculateNet($gross, $countryCode);
739739
$this->assertEquals(24.00, $result);
@@ -835,7 +835,7 @@ public function testCalculateHighVatType()
835835
$type = 'high';
836836
$postalCode = null;
837837

838-
$vatCalculator = new VatCalculator();
838+
$vatCalculator = new VatCalculator;
839839
$result = $vatCalculator->calculate($gross, $countryCode, $postalCode, $company, $type);
840840

841841
$this->assertEquals(29.04, $result);
@@ -849,7 +849,7 @@ public function testCalculateLowVatType()
849849
$type = 'low';
850850
$postalCode = null;
851851

852-
$vatCalculator = new VatCalculator();
852+
$vatCalculator = new VatCalculator;
853853
$result = $vatCalculator->calculate($gross, $countryCode, $postalCode, $company, $type);
854854

855855
$this->assertEquals(26.16, $result);
@@ -927,7 +927,7 @@ public function testIsValidVatNumberFormat()
927927
'SK1234567890',
928928
];
929929

930-
$vatCalculator = new VatCalculator();
930+
$vatCalculator = new VatCalculator;
931931

932932
foreach ($valid as $format) {
933933
$this->assertTrue($vatCalculator->isValidVatNumberFormat($format), "{$format} did not pass validation.");

0 commit comments

Comments
 (0)