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

Prepare for PHP7.2 #708

Merged
merged 1 commit into from
Mar 24, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ php:
- '5.6'
- '7.0'
- '7.1'
- nightly

matrix:
fast_finish: true
Expand All @@ -33,8 +32,13 @@ matrix:
env: SYMFONY_VERSION='~3.2.0'
- php: '7.1'
env: SYMFONY_VERSION='~3.3.0@dev'
- php: 'nightly'
env:
- COMPOSER_FLAGS='--ignore-platform-reqs'
- SYMFONY_DEPRECATIONS_HELPER='weak'
- SYMFONY_VERSION='~3.3.0@dev'
allow_failures:
- php: nightly
- php: 'nightly'
- env: SYMFONY_VERSION='~3.3.0@dev'

install:
Expand Down
26 changes: 16 additions & 10 deletions src/Nelmio/Alice/Fixtures/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,19 +368,25 @@ protected function getConstructorComponents()
throw new \UnexpectedValueException("The __construct call in object '{$this}' must be defined as an array of arguments or false to bypass it");
}

list($method, $args) = each($constructorValue);
if ($method !== 0) {
if (!is_callable([$this->class, $method])) {
throw new \UnexpectedValueException("Cannot call static method '{$method}' on class '{$this->class}' as a constructor for object '{$this}'");
}
if (!is_array($args)) {
throw new \UnexpectedValueException("The static '{$method}' call in object '{$this}' must be given an array");
foreach ($constructorValue as $method => $args) {
if ($method !== 0) {
if (!is_callable([$this->class, $method])) {
throw new \UnexpectedValueException(
"Cannot call static method '{$method}' on class '{$this->class}' as a constructor for object '{$this}'"
);
}

if (!is_array($args)) {
throw new \UnexpectedValueException(
"The static '{$method}' call in object '{$this}' must be given an array"
);
}

return ['method' => $method, 'args' => $args];
}

return ['method' => $method, 'args' => $args];
return ['method' => '__construct', 'args' => $constructorValue];
}

return ['method' => '__construct', 'args' => $constructorValue];
}

/**
Expand Down