Skip to content

Commit 3a6fba8

Browse files
committed
Take advantage of PHP >= 7.1 functionality
- Use nullable types and void return type were possible. - Fix autodocs for non-static methods. - Update Travis configuration (use bionic and update to vips 8.10). - Update dependencies. - Improve install-vips.sh script.
1 parent 1ea7d0e commit 3a6fba8

18 files changed

+311
-292
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ vendor
33
composer.lock
44
/docs
55
*.swp
6+
.phpunit.result.cache

Diff for: .travis.yml

+24-22
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
sudo: false
2-
31
language: php
42

5-
dist: trusty
3+
dist: bionic
64

75
php:
8-
- 7.0.13
96
- 7.1
7+
- 7.4
108

119
env:
1210
global:
13-
- VIPS_VERSION_MAJOR=8
14-
- VIPS_VERSION_MINOR=6
15-
- VIPS_VERSION_MICRO=3
11+
- VIPS_VERSION=8.10.0
1612
- PATH=$HOME/vips/bin:$PATH
1713
- LD_LIBRARY_PATH=$HOME/vips/lib:$LD_LIBRARY_PATH
1814
- PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig:$PKG_CONFIG_PATH
19-
- PYTHONPATH=$HOME/vips/lib/python2.7/site-packages:$PYTHONPATH
20-
- GI_TYPELIB_PATH=$HOME/vips/lib/girepository-1.0:$GI_TYPELIB_PATH
2115

2216
cache:
2317
apt: true
@@ -28,30 +22,38 @@ cache:
2822
addons:
2923
apt:
3024
packages:
31-
- gobject-introspection
32-
- libcfitsio3-dev
25+
# main dependencies
26+
- libcfitsio-dev
27+
- libexif-dev
28+
- libexpat1-dev
3329
- libfftw3-dev
3430
- libgif-dev
35-
- libgs-dev
3631
- libgsf-1-dev
32+
- libgsl-dev
33+
- libheif-dev
34+
- liblcms2-dev
35+
- libmagickwand-dev
3736
- libmatio-dev
37+
- libnifti-dev
38+
- libopenexr-dev
3839
- libopenslide-dev
3940
- liborc-0.4-dev
4041
- libpango1.0-dev
42+
- libpng-dev
4143
- libpoppler-glib-dev
44+
- librsvg2-dev
45+
- libtiff5-dev
4246
- libwebp-dev
47+
# needed for building libvips from source
48+
- gtk-doc-tools
49+
- gobject-introspection
4350

4451
before_install:
45-
- bash install-vips.sh
46-
--disable-debug
47-
--disable-dependency-tracking
48-
--disable-introspection
49-
--disable-static
50-
--enable-gtk-doc-html=no
51-
--enable-gtk-doc=no
52-
--enable-pyvips8=no
53-
--without-orc
54-
--without-python
52+
- bash install-vips.sh
53+
--disable-dependency-tracking
54+
--disable-introspection
55+
--disable-gtk-doc-html
56+
--disable-gtk-doc
5557
- yes '' | pecl install vips
5658

5759
install: composer install --prefer-dist

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Changelog
22
All notable changes to `:vips` will be documented in this file.
33

4+
### 1.0.7 - 2020-08-28
5+
6+
### Added
7+
- use nullable types and void return type were possible
8+
9+
### Deprecated
10+
- requires php >= 7.1
11+
12+
### Fixed
13+
- fix autodocs for non-static methods
14+
15+
### Remove
16+
- Nothing
17+
18+
### Security
19+
- Nothing
20+
421
## 1.0.6 - 2020-08-28
522

623
### Added

Diff for: README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,8 @@ libvips properties as properties of the PHP `Vips\Image` class.
163163
### Test and install
164164

165165
```
166-
$ phpcs --standard=PSR2 src
167166
$ composer install
168-
$ vendor/bin/phpunit
167+
$ composer test
169168
$ vendor/bin/phpdoc
170169
```
171170

Diff for: composer.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">=7.0.11",
20+
"php": ">=7.1",
2121
"ext-vips": ">=0.1.2",
22-
"psr/log": "^1.0.2"
22+
"psr/log": "^1.1.3"
2323
},
2424
"require-dev": {
25-
"jms/serializer" : ">=0.12 < 1.8.0",
26-
"phpunit/phpunit": "^6.5",
27-
"phpdocumentor/phpdocumentor" : "^2.9",
28-
"jakub-onderka/php-parallel-lint": "^1.0.0",
29-
"squizlabs/php_codesniffer": "3.*"
25+
"php-parallel-lint/php-parallel-lint": "^1.2",
26+
"phpdocumentor/phpdocumentor": "3.0.0-rc",
27+
"phpunit/phpunit": "^9.3",
28+
"squizlabs/php_codesniffer": "^3.5"
3029
},
3130
"autoload": {
3231
"psr-4": {
@@ -49,5 +48,7 @@
4948
"phpunit",
5049
"phpcs --standard=phpcs-ruleset.xml ."
5150
]
52-
}
51+
},
52+
"minimum-stability": "dev",
53+
"prefer-stable": true
5354
}

Diff for: examples/generate_phpdoc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def generate_operation(operation_name):
111111
result += 'array '
112112

113113
result += '{0}('.format(operation_name)
114-
for name in intro.required_input:
114+
for name in intro.method_args:
115115
details = intro.details[name]
116116
result += '{0} ${1}, '.format(gtype_to_php(details['type']), name)
117117

@@ -121,7 +121,7 @@ def generate_operation(operation_name):
121121
result += description[0].upper() + description[1:] + '.\n'
122122

123123
# find any Enums we've referenced and output @see lines for them
124-
for name in intro.required_output + intro.required_input:
124+
for name in intro.required_output + intro.method_args:
125125
details = intro.details[name]
126126
fundamental = gobject_lib.g_type_fundamental(details['type'])
127127

Diff for: install-vips.sh

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
#!/bin/bash
22

3-
vips_site=https://github.com/libvips/libvips/releases/download
4-
version=$VIPS_VERSION_MAJOR.$VIPS_VERSION_MINOR.$VIPS_VERSION_MICRO
3+
version=$VIPS_VERSION
4+
vips_tarball=https://github.com/libvips/libvips/releases/download/v$version/vips-$version.tar.gz
55

66
set -e
77

88
# do we already have the correct vips built? early exit if yes
99
# we could check the configure params as well I guess
1010
if [ -d "$HOME/vips/bin" ]; then
11-
installed_version=$($HOME/vips/bin/vips --version)
12-
escaped_version="$VIPS_VERSION_MAJOR\.$VIPS_VERSION_MINOR\.$VIPS_VERSION_MICRO"
13-
echo "Need vips-$version"
14-
echo "Found $installed_version"
15-
if [[ "$installed_version" =~ ^vips-$escaped_version ]]; then
16-
echo "Using cached directory"
17-
exit 0
18-
fi
11+
installed_version=$($HOME/vips/bin/vips --version | awk -F- '{print $2}')
12+
echo "Need vips $version"
13+
echo "Found vips $installed_version"
14+
15+
if [ "$installed_version" == "$version" ]; then
16+
echo "Using cached vips directory"
17+
exit 0
18+
fi
1919
fi
2020

2121
rm -rf $HOME/vips
22-
wget $vips_site/v$version/vips-$version.tar.gz
23-
tar xf vips-$version.tar.gz
22+
curl -Ls $vips_tarball | tar xz
2423
cd vips-$version
25-
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips $*
26-
make && make install
24+
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips "$@"
25+
make -j`nproc` && make install

Diff for: phpcs-ruleset.xml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<!-- Ignore Composer dependencies -->
1010
<exclude-pattern>vendor/</exclude-pattern>
1111

12+
<!-- Ignore generated docs -->
13+
<exclude-pattern>docs/</exclude-pattern>
14+
1215
<!-- Display progress -->
1316
<arg value="p"/>
1417

Diff for: phpunit.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
convertNoticesToExceptions="true"
99
convertWarningsToExceptions="true"
1010
processIsolation="false"
11-
stopOnFailure="false"
12-
syntaxCheck="false">
11+
stopOnFailure="false">
1312
<testsuites>
1413
<testsuite name="Vips Test Suite">
1514
<directory suffix=".php">./tests/</directory>

Diff for: src/Config.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ class Config
7171
*
7272
* @return void
7373
*/
74-
public static function setLogger(LoggerInterface $logger)
74+
public static function setLogger(LoggerInterface $logger): void
7575
{
7676
self::$logger = $logger;
7777
}
7878

7979
/**
8080
* Gets a logger.
8181
*
82-
* @return LoggerInterface $logger|null
82+
* @return LoggerInterface|null The logger or null.
8383
*/
84-
public static function getLogger()
84+
public static function getLogger(): ?LoggerInterface
8585
{
8686
return self::$logger;
8787
}
@@ -94,7 +94,7 @@ public static function getLogger()
9494
*
9595
* @return void
9696
*/
97-
public static function cacheSetMax($value)
97+
public static function cacheSetMax(int $value): void
9898
{
9999
vips_cache_set_max($value);
100100
}
@@ -103,12 +103,12 @@ public static function cacheSetMax($value)
103103
* Set the maximum amount of memory to allow cached operations to use, in
104104
* bytes.
105105
*
106-
* @param integer $value The maximum amount of memory cached opertations can
106+
* @param integer $value The maximum amount of memory cached operations can
107107
* hold, in bytes.
108108
*
109109
* @return void
110110
*/
111-
public static function cacheSetMaxMem($value)
111+
public static function cacheSetMaxMem(int $value): void
112112
{
113113
vips_cache_set_max_mem($value);
114114
}
@@ -121,7 +121,7 @@ public static function cacheSetMaxMem($value)
121121
*
122122
* @return void
123123
*/
124-
public static function cacheSetMaxFiles($value)
124+
public static function cacheSetMaxFiles(int $value): void
125125
{
126126
vips_cache_set_max_files($value);
127127
}
@@ -135,13 +135,13 @@ public static function cacheSetMaxFiles($value)
135135
*
136136
* @return void
137137
*/
138-
public static function concurrencySet($value)
138+
public static function concurrencySet(int $value): void
139139
{
140140
vips_concurrency_set($value);
141141
}
142142

143143
/**
144-
* Gets the libvips version number as a atring of the form
144+
* Gets the libvips version number as a string of the form
145145
* MAJOR.MINOR.MICRO, for example "8.6.1".
146146
*
147147
* @return string

0 commit comments

Comments
 (0)