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

Drop support for PHP 5.3 #410

Merged
merged 1 commit into from
Jan 4, 2018
Merged
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
55 changes: 15 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,27 @@ sudo: false

language: php

matrix:
include:
- php: 5.3
env: AUTOLOAD=1
dist: precise
- php: 5.3
env: AUTOLOAD=0
dist: precise
- php: 5.4
env: AUTOLOAD=1
- php: 5.4
env: AUTOLOAD=0
- php: 5.5
env: AUTOLOAD=1
- php: 5.5
env: AUTOLOAD=0
- php: 5.6
env: AUTOLOAD=1
- php: 5.6
env: AUTOLOAD=0
- php: 7.0
env: AUTOLOAD=1
- php: 7.0
env: AUTOLOAD=0
- php: 7.1
env: AUTOLOAD=1
- php: 7.1
env: AUTOLOAD=0
- php: 7.2
env: AUTOLOAD=1
- php: 7.2
env: AUTOLOAD=0
- php: hhvm
env: AUTOLOAD=1
- php: hhvm
env: AUTOLOAD=0
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm

env:
global:
- STRIPE_MOCK_VERSION=0.5.0
matrix:
- AUTOLOAD=1
- AUTOLOAD=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing this whole thing back :)


cache:
directories:
- $HOME/.composer/cache/files
- stripe-mock

env:
global:
- STRIPE_MOCK_VERSION=0.5.0

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
- |
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can sign up for a Stripe account at https://stripe.com.

## Requirements

PHP 5.3.3 and later.
PHP 5.4.0 and later.

## Composer

Expand Down Expand Up @@ -60,6 +60,12 @@ Please see https://stripe.com/docs/api for up-to-date documentation.

## Legacy Version Support

### PHP 5.3

If you are using PHP 5.3, you can download v5.8.0 ([zip](https://github.com/stripe/stripe-php/archive/v5.8.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.8.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding a scary blurb about how bad using this version (and 5.2) is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't hurt!


### PHP 5.2

If you are using PHP 5.2, you can download v1.18.0 ([zip](https://github.com/stripe/stripe-php/archive/v1.18.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v1.18.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses.

This legacy version may be included via `require_once("/path/to/stripe-php/lib/Stripe.php");`, and used like:
Expand Down
2 changes: 1 addition & 1 deletion build.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$composer = json_decode(file_get_contents('composer.json'), true);
unset($composer['autoload']);
unset($composer['require-dev']['squizlabs/php_codesniffer']);
file_put_contents('composer.json', json_encode($composer));
file_put_contents('composer.json', json_encode($composer, JSON_PRETTY_PRINT));
}

passthru('composer install', $returnStatus);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": ">=5.3.3",
"php": ">=5.4.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*"
Expand Down
1 change: 0 additions & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

// Plumbing
require(dirname(__FILE__) . '/lib/ApiResponse.php');
require(dirname(__FILE__) . '/lib/JsonSerializable.php');
require(dirname(__FILE__) . '/lib/StripeObject.php');
require(dirname(__FILE__) . '/lib/ApiRequestor.php');
require(dirname(__FILE__) . '/lib/ApiResource.php');
Expand Down
18 changes: 0 additions & 18 deletions lib/JsonSerializable.php

This file was deleted.

13 changes: 3 additions & 10 deletions lib/StripeObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

namespace Stripe;

use ArrayAccess;
use InvalidArgumentException;

/**
* Class StripeObject
*
* @package Stripe
*/
class StripeObject implements ArrayAccess, JsonSerializable
class StripeObject implements \ArrayAccess, \JsonSerializable
{
/**
* @var Util\Set Attributes that should not be sent to the API because
Expand Down Expand Up @@ -105,7 +102,7 @@ public function __construct($id = null, $opts = null)
public function __set($k, $v)
{
if ($v === "") {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'You cannot set \''.$k.'\'to an empty string. '
.'We interpret empty strings as NULL in requests. '
.'You may set obj->'.$k.' = NULL to delete the property'
Expand Down Expand Up @@ -292,11 +289,7 @@ public function jsonSerialize()

public function __toJSON()
{
if (defined('JSON_PRETTY_PRINT')) {
return json_encode($this->__toArray(true), JSON_PRETTY_PRINT);
} else {
return json_encode($this->__toArray(true));
}
return json_encode($this->__toArray(true), JSON_PRETTY_PRINT);
}

public function __toString()
Expand Down
5 changes: 0 additions & 5 deletions tests/Stripe/StripeObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ public function testPropertyDoesNotExists()

public function testJsonEncode()
{
// We can only JSON encode our objects in PHP 5.4+. 5.3 must use ->__toJSON()
if (version_compare(phpversion(), '5.4.0', '<')) {
return;
}

$s = new StripeObject();
$s->foo = 'a';

Expand Down