Skip to content

Take advantage of PHP >= 7.1 functionality #102

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

Merged
merged 3 commits into from
Aug 28, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vendor
composer.lock
/docs
*.swp
.phpunit.result.cache
47 changes: 24 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
sudo: false

language: php

dist: trusty
dist: bionic

php:
- 7.0.13
- 7.1
- 7.3
- 7.4

env:
global:
- VIPS_VERSION_MAJOR=8
- VIPS_VERSION_MINOR=6
- VIPS_VERSION_MICRO=3
- VIPS_VERSION=8.10.0
- PATH=$HOME/vips/bin:$PATH
- LD_LIBRARY_PATH=$HOME/vips/lib:$LD_LIBRARY_PATH
- PKG_CONFIG_PATH=$HOME/vips/lib/pkgconfig:$PKG_CONFIG_PATH
- PYTHONPATH=$HOME/vips/lib/python2.7/site-packages:$PYTHONPATH
- GI_TYPELIB_PATH=$HOME/vips/lib/girepository-1.0:$GI_TYPELIB_PATH

cache:
apt: true
Expand All @@ -28,30 +22,37 @@ cache:
addons:
apt:
packages:
- gobject-introspection
- libcfitsio3-dev
# main dependencies
- libcfitsio-dev
- libexif-dev
- libexpat1-dev
- libfftw3-dev
- libgif-dev
- libgs-dev
- libgsf-1-dev
- libgsl-dev
- liblcms2-dev
- libmagickwand-dev
- libmatio-dev
- libnifti-dev
- libopenexr-dev
- libopenslide-dev
- liborc-0.4-dev
- libpango1.0-dev
- libpng-dev
- libpoppler-glib-dev
- librsvg2-dev
- libtiff5-dev
- libwebp-dev
# needed for building libvips from source
- gtk-doc-tools
- gobject-introspection

before_install:
- bash install-vips.sh
--disable-debug
--disable-dependency-tracking
--disable-introspection
--disable-static
--enable-gtk-doc-html=no
--enable-gtk-doc=no
--enable-pyvips8=no
--without-orc
--without-python
- bash install-vips.sh
--disable-dependency-tracking
--disable-introspection
--disable-gtk-doc-html
--disable-gtk-doc
- yes '' | pecl install vips

install: composer install --prefer-dist
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Changelog
All notable changes to `:vips` will be documented in this file.

### 1.0.7 - 2020-08-28

### Added
- use nullable types and void return type were possible

### Deprecated
- requires php >= 7.1

### Fixed
- fix autodocs for non-static methods

### Remove
- Nothing

### Security
- Nothing

## 1.0.6 - 2020-08-28

### Added
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ libvips properties as properties of the PHP `Vips\Image` class.
### Test and install

```
$ phpcs --standard=PSR2 src
$ composer install
$ vendor/bin/phpunit
$ composer test
$ vendor/bin/phpdoc
```

Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
}
],
"require": {
"php": ">=7.0.11",
"php": ">=7.1",
"ext-vips": ">=0.1.2",
"psr/log": "^1.0.2"
"psr/log": "^1.1.3"
},
"require-dev": {
"jms/serializer" : ">=0.12 < 1.8.0",
"phpunit/phpunit": "^6.5",
"phpdocumentor/phpdocumentor" : "^2.9",
"jakub-onderka/php-parallel-lint": "^1.0.0",
"squizlabs/php_codesniffer": "3.*"
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpdocumentor/phpdocumentor": "3.0.0-rc",
"phpunit/phpunit": "^9.3",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
"psr-4": {
Expand All @@ -49,5 +48,7 @@
"phpunit",
"phpcs --standard=phpcs-ruleset.xml ."
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
4 changes: 2 additions & 2 deletions examples/generate_phpdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def generate_operation(operation_name):
result += 'array '

result += '{0}('.format(operation_name)
for name in intro.required_input:
for name in intro.method_args:
Copy link
Member

Choose a reason for hiding this comment

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

Ooops! I was tired :(

details = intro.details[name]
result += '{0} ${1}, '.format(gtype_to_php(details['type']), name)

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

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

Expand Down
27 changes: 13 additions & 14 deletions install-vips.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
#!/bin/bash

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

set -e

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

if [ "$installed_version" == "$version" ]; then
echo "Using cached vips directory"
exit 0
fi
fi

rm -rf $HOME/vips
wget $vips_site/v$version/vips-$version.tar.gz
tar xf vips-$version.tar.gz
curl -Ls $vips_tarball | tar xz
cd vips-$version
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips $*
make && make install
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 ./configure --prefix=$HOME/vips "$@"
make -j`nproc` && make install
3 changes: 3 additions & 0 deletions phpcs-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<!-- Ignore Composer dependencies -->
<exclude-pattern>vendor/</exclude-pattern>

<!-- Ignore generated docs -->
<exclude-pattern>docs/</exclude-pattern>

<!-- Display progress -->
<arg value="p"/>

Expand Down
3 changes: 1 addition & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="Vips Test Suite">
<directory suffix=".php">./tests/</directory>
Expand Down
18 changes: 9 additions & 9 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ class Config
*
* @return void
*/
public static function setLogger(LoggerInterface $logger)
public static function setLogger(LoggerInterface $logger): void
{
self::$logger = $logger;
}

/**
* Gets a logger.
*
* @return LoggerInterface $logger|null
* @return LoggerInterface|null The logger or null.
*/
public static function getLogger()
public static function getLogger(): ?LoggerInterface
{
return self::$logger;
}
Expand All @@ -94,7 +94,7 @@ public static function getLogger()
*
* @return void
*/
public static function cacheSetMax($value)
public static function cacheSetMax(int $value): void
{
vips_cache_set_max($value);
}
Expand All @@ -103,12 +103,12 @@ public static function cacheSetMax($value)
* Set the maximum amount of memory to allow cached operations to use, in
* bytes.
*
* @param integer $value The maximum amount of memory cached opertations can
* @param integer $value The maximum amount of memory cached operations can
* hold, in bytes.
*
* @return void
*/
public static function cacheSetMaxMem($value)
public static function cacheSetMaxMem(int $value): void
{
vips_cache_set_max_mem($value);
}
Expand All @@ -121,7 +121,7 @@ public static function cacheSetMaxMem($value)
*
* @return void
*/
public static function cacheSetMaxFiles($value)
public static function cacheSetMaxFiles(int $value): void
{
vips_cache_set_max_files($value);
}
Expand All @@ -135,13 +135,13 @@ public static function cacheSetMaxFiles($value)
*
* @return void
*/
public static function concurrencySet($value)
public static function concurrencySet(int $value): void
{
vips_concurrency_set($value);
}

/**
* Gets the libvips version number as a atring of the form
* Gets the libvips version number as a string of the form
* MAJOR.MINOR.MICRO, for example "8.6.1".
*
* @return string
Expand Down
Loading