Browse Source

Merge pull request #19 from harikt/create-func

create_function has been DEPRECATED as of PHP 7.2.0
pull/21/head
Jamie Isaacs 2 years ago
committed by GitHub
parent
commit
8d1cd60d1a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .travis.yml
  2. 4
      composer.json
  3. 4
      src/RateAdapter.php
  4. 6
      src/Ship.php
  5. 2
      src/UPS/Rate.php
  6. 4
      tests/ArrTest.php
  7. 4
      tests/Fedex/FedexTest.php
  8. 3
      tests/PackageDimensionsTest.php
  9. 4
      tests/PackageTest.php
  10. 3
      tests/QuoteTest.php
  11. 4
      tests/RateAdapterTest.php
  12. 3
      tests/ShipTest.php
  13. 4
      tests/ShipmentTest.php
  14. 3
      tests/UPS/RateTest.php
  15. 3
      tests/USPS/RateTest.php
  16. 4
      tests/ValidatorTest.php

3
.travis.yml

@ -1,6 +1,9 @@
language: php
php:
- 7.1
- 7.2
- 7.3
- 7.4
before_script:
- composer install --prefer-dist

4
composer.json

@ -15,8 +15,8 @@
}
},
"require-dev": {
"phpunit/phpunit": "4.0.*",
"squizlabs/php_codesniffer": "1.5.5"
"phpunit/phpunit": "7.0.*",
"squizlabs/php_codesniffer": "3.5.*"
},
"require": {
"php": ">=7.1"

4
src/RateAdapter.php

@ -95,6 +95,8 @@ abstract class RateAdapter
protected function sortByCost()
{
uasort($this->rates, create_function('$a, $b', 'return ($a->getCost() > $b->getCost());'));
uasort($this->rates, function ($a, $b) {
return ($a->getCost() > $b->getCost());
});
}
}

6
src/Ship.php

@ -139,8 +139,10 @@ class Ship
return $display_rates;
}
protected function sortByCost(& $rates)
protected function sortByCost(&$rates)
{
uasort($rates, create_function('$a, $b', 'return ($a->getCost() > $b->getCost());'));
uasort($rates, function ($a, $b) {
return ($a->getCost() > $b->getCost());
});
}
}

2
src/UPS/Rate.php

@ -95,8 +95,8 @@ class Rate extends RateAdapter
]);
$this->setRequestAdapter(Arr::get($options, 'requestAdapter', new RateRequest\Post()));
}
protected function validate()
{
$this->validatePackages();

4
tests/ArrTest.php

@ -1,7 +1,9 @@
<?php
namespace pdt256\Shipping;
class ArrTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class ArrTest extends TestCase
{
public function providerGet()
{

4
tests/Fedex/FedexTest.php

@ -7,8 +7,9 @@ use pdt256\Shipping\Package;
use pdt256\Shipping\Shipment;
use pdt256\Shipping\Quote;
use DateTime;
use PHPUnit\Framework\TestCase;
class RateTest extends \PHPUnit_Framework_TestCase
class RateTest extends TestCase
{
/** @var Shipment */
protected $shipment;
@ -182,6 +183,5 @@ class RateTest extends \PHPUnit_Framework_TestCase
'requestAdapter' => new StubFedex,
]);
$rateAdapter->getRates();
}
}

3
tests/PackageDimensionsTest.php

@ -5,8 +5,9 @@ namespace pdt256\Shipping;
use pdt256\Shipping\RateRequest\StubFedex;
use pdt256\Shipping\RateRequest\StubUPS;
use pdt256\Shipping\RateRequest\StubUSPS;
use PHPUnit\Framework\TestCase;
class PackageDimensionsValidationTrait extends \PHPUnit_Framework_TestCase
class PackageDimensionsValidationTrait extends TestCase
{
protected function getNormalPackage()
{

4
tests/PackageTest.php

@ -1,7 +1,9 @@
<?php
namespace pdt256\Shipping;
class PackageTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class PackageTest extends TestCase
{
public function testCreate()
{

3
tests/QuoteTest.php

@ -2,8 +2,9 @@
namespace pdt256\Shipping;
use DateTime;
use PHPUnit\Framework\TestCase;
class QuoteTest extends \PHPUnit_Framework_TestCase
class QuoteTest extends TestCase
{
public function testCreate()
{

4
tests/RateAdapterTest.php

@ -1,7 +1,9 @@
<?php
namespace pdt256\Shipping;
class RateAdapterTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class RateAdapterTest extends TestCase
{
public function testCreate()
{

3
tests/ShipTest.php

@ -2,8 +2,9 @@
namespace pdt256\Shipping;
use DateTime;
use PHPUnit\Framework\TestCase;
class ShipTest extends \PHPUnit_Framework_TestCase
class ShipTest extends TestCase
{
/** @var Shipment */
public $shipment;

4
tests/ShipmentTest.php

@ -1,7 +1,9 @@
<?php
namespace pdt256\Shipping;
class ShipmentTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class ShipmentTest extends TestCase
{
public function testCreate()
{

3
tests/UPS/RateTest.php

@ -6,8 +6,9 @@ use pdt256\Shipping\Ship;
use pdt256\Shipping\Package;
use pdt256\Shipping\Shipment;
use pdt256\Shipping\Quote;
use PHPUnit\Framework\TestCase;
class RateTest extends \PHPUnit_Framework_TestCase
class RateTest extends TestCase
{
/** @var Shipment */
protected $shipment;

3
tests/USPS/RateTest.php

@ -6,8 +6,9 @@ use pdt256\Shipping\Ship;
use pdt256\Shipping\Package;
use pdt256\Shipping\Shipment;
use pdt256\Shipping\Quote;
use PHPUnit\Framework\TestCase;
class RateTest extends \PHPUnit_Framework_TestCase
class RateTest extends TestCase
{
/** @var Shipment */
protected $shipment;

4
tests/ValidatorTest.php

@ -1,7 +1,9 @@
<?php
namespace pdt256\Shipping;
class ValidatorTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class ValidatorTest extends TestCase
{
/**
* @expectedException \LogicException

Loading…
Cancel
Save