Skip to content

Commit 26c3ef1

Browse files
authored
Merge pull request #18 from contentful/feat/php7
Upgrade to require PHP 7
2 parents aea6854 + 7572e95 commit 26c3ef1

File tree

93 files changed

+1540
-930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1540
-930
lines changed

.circleci/config.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- run:
2525
name: Static analysis
2626
command: |
27-
wget https://github.com/phpstan/phpstan/releases/download/0.9.2/phpstan.phar -q -O phpstan.phar
27+
wget https://github.com/phpstan/phpstan/releases/download/0.10.3/phpstan.phar -q -O phpstan.phar
2828
composer run lint-static-analysis
2929
3030
test56:
@@ -52,10 +52,22 @@ jobs:
5252
- run: { name: "Test suite", command: "composer test-quick-fail" }
5353

5454
test72:
55+
environment:
56+
CC_TEST_REPORTER_ID: 12e3510bd320a9a0acecb33d12f6c95318256eab19ffd3cca5520705140ba836
5557
docker:
5658
- image: circleci/php:7.2-cli
5759
steps:
5860
- checkout
61+
- run:
62+
name: Set up Code Climate test-reporter
63+
command: |
64+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
65+
chmod +x ./cc-test-reporter
5966
- run: { name: "Install dependencies", command: "sudo composer self-update && composer install -n --prefer-dist" }
60-
- run: { name: "Test suite", command: "composer test-quick-fail" }
61-
- run: { name: "Upload code coverage", command: "bash <(curl -s https://codecov.io/bash) -f build/logs/clover.xml" }
67+
- run:
68+
name: Test suite
69+
command: |
70+
sudo docker-php-ext-enable xdebug
71+
./cc-test-reporter before-build
72+
composer test-quick-fail
73+
./cc-test-reporter after-build --coverage-input-type clover --exit-code $?

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto
2+
3+
/.gitattributes export-ignore
4+
/.gitignore export-ignore
5+
/.editorconfig export-ignore
6+
/.php_cs export-ignore
7+
/phpunit.xml.dist export-ignore
8+
/tests export-ignore
9+
/sami.php export-ignore
10+
/.github export-ignore
11+
/UPGRADE-2.0.md

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @dborsatto

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/vendor/
33
/composer.lock
44
/.php_cs.cache
5+
/clover.xml

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ $config = require __DIR__.'/scripts/php-cs-fixer.php';
44

55
return $config(
66
'contentful-core',
7-
false,
7+
true,
88
['scripts', 'src', 'tests']
99
);

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased](https://github.com/contentful/contentful-core.php/compare/1.5.0...HEAD)
77

8+
### Upgrade
9+
10+
Please refer to the [upgrade guide](UPGRADE-2.0.md) for detailed info about the new version.
11+
12+
### Added
13+
14+
* Class `Contentful\Core\File\ImageOptions` now has a `setPng8Bit` method which will force the image to be returned as a 8-bit PNG.
15+
* Interface `Contentful\Core\File\ProcessedFileInterface` has been introduced, and can be used to identify assets that have already been processed and have a `url` property available.
16+
17+
### Changed
18+
19+
* Class `Contentful\Core\Api\BaseClient` no longer has abstract method `getSdkVersion`, now instead it requires `getPackageName`. The version of the SDK will be inferred automatically using that value.
20+
* Options array in `Contentful\Core\Api\BaseClient::request` now uses property `host` instead of `baseUri`.
21+
822
## [1.5.0](https://github.com/contentful/contentful-core.php/tree/1.5.0) (2018-08-30)
923

1024
### Added
@@ -36,6 +50,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3650
* `Contentful\Core\Api\Location` used to provide a wrongful serialization of the longitude property. Now it correctly serializes to `lon` instead of `long`.
3751

3852
### Changed
53+
3954
* The `Contentful\Core\Log\Timer` has been deprecated and will be removed in version 2.
4055

4156
## [1.0.0](https://github.com/contentful/contentful-core.php/tree/1.0.0) (2018-04-17)

UPGRADE-2.0.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# UPGRADE FROM 1.x to 2.0
2+
3+
## PHP Version
4+
5+
This SDK now requires PHP 7.0, which means all files now use the `strict_types` directive and scalar type declarations whenever possible.
6+
7+
## Change in BaseClient abstract methods
8+
9+
The class `Contentful\Core\Api\BaseClient` no longer requires the method `getSdkVersion` to be defined, but it now requires `getPackageName`, which should return the Packagist name (e.g. `contentful/core`). This name will then be used to automatically infer the SDK version number.
10+
11+
## Change in BaseClient::request()
12+
13+
Options array in `Contentful\Core\Api\BaseClient::request()` now uses property `host` instead of `baseUri`.
14+
15+
## Removal of Timer class
16+
17+
The class `Contentful\Core\Log\Timer` was deprecated in version 1.1 and has now been removed.
18+
19+
## Removal of third parameter in Query::where()
20+
21+
The method `Contentful\Core\Api\BaseQuery::where()` no longer accepts a third parameter. Now simply include that as part of the first parameter:
22+
23+
```php
24+
// Before
25+
$query->where('sys.id', $someId, 'ne');
26+
27+
// After
28+
$query->where('sys.id[ne]', $someId);
29+
```

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
"type": "library",
44
"description": "Foundation library for Contentful PHP SDKs",
55
"require": {
6-
"php": "^5.6|^7.0",
6+
"php": "^7.0",
77
"ext-json": "*",
88
"guzzlehttp/guzzle": "^6.3",
99
"guzzlehttp/psr7": "^1.4",
1010
"psr/http-message": "^1.0",
11-
"psr/log": "^1.0"
11+
"psr/log": "^1.0",
12+
"jean85/pretty-package-versions": "^1.2"
1213
},
1314
"require-dev": {
14-
"phpunit/phpunit": "^5.7",
15+
"phpunit/phpunit": "^6.0|7.0",
1516
"symfony/finder": "^3.0|^4.0",
1617
"monolog/monolog": "^1.23"
1718
},
@@ -24,7 +25,8 @@
2425
"autoload-dev": {
2526
"psr-4": {
2627
"Contentful\\Tests\\Core\\": "tests"
27-
}
28+
},
29+
"files": ["scripts/TestCase.php"]
2830
},
2931
"scripts": {
3032
"test": "vendor/bin/phpunit",
@@ -34,7 +36,7 @@
3436
},
3537
"extra": {
3638
"branch-alias": {
37-
"dev-master": "1.6.0-dev"
39+
"dev-master": "2.0.0-dev"
3840
}
3941
}
4042
}

phpstan.phar

4.16 MB
Binary file not shown.

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<logging>
1010
<log type="coverage-html" target="build/coverage" title="contentful-core.php" lowUpperBound="35" highLowerBound="70" />
11-
<log type="coverage-clover" target="build/logs/clover.xml"/>
11+
<log type="coverage-clover" target="clover.xml"/>
1212
</logging>
1313

1414
<filter>

0 commit comments

Comments
 (0)