Skip to content

Commit

Permalink
Merge 388ca56 into 5d4ee73
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Kalkbrenner committed Apr 5, 2019
2 parents 5d4ee73 + 388ca56 commit 0e06e4d
Show file tree
Hide file tree
Showing 501 changed files with 4,180 additions and 3,600 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -5,10 +5,11 @@ dist: trusty
php:
- 7.3
- 7.2
- 7.1
- nightly

env:
- SYMFONY_VERSION=4.2.* SOLR_VERSION=8.0.0 SOLR_CLOUD=true
- SYMFONY_VERSION=4.2.* SOLR_VERSION=8.0.0 SOLR_CLOUD=false
- SYMFONY_VERSION=4.2.* SOLR_VERSION=7.7.1 SOLR_CLOUD=true
- SYMFONY_VERSION=4.2.* SOLR_VERSION=7.7.1 SOLR_CLOUD=false
- SYMFONY_VERSION=4.2.* SOLR_VERSION=6.6.5 SOLR_CLOUD=false
Expand Down
18 changes: 15 additions & 3 deletions CHANGELOG.md
Expand Up @@ -4,10 +4,22 @@ All notable changes to the solarium library will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [4.3.0-beta.1]
## [5.0.0-alpha.1]
### Added
- Solr 8 support

### Changed
- Updated dev and test environments to newer package versions, for example PHPUnit 7.5
- Increased the number of PHP 7.1 style argument and return type declarations (transition not completed yet)
- Updated dev and test environments to newer package versions, for example PHPUnit 8.0
- Use PHP 7.1 style argument and return type declarations
- PHP 7.1 or higher required
- Renamed the two variants of DocumentInterface to ResultDocumentInterface and UpdateDocumentInterface to reduce confusion

### Removed
- PHP 7.0 support

### Fixed
- Status codes of the HTTPAdapter


## [4.3.0-alpha.2]
### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -19,7 +19,7 @@
},
"require-dev": {
"guzzlehttp/guzzle": "^3.8 || ^6.2",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^8.0",
"php-coveralls/php-coveralls": "^2.1",
"squizlabs/php_codesniffer": "^3.4",
"zendframework/zend-http": "^2.8"
Expand Down
6 changes: 3 additions & 3 deletions src/Client.php
Expand Up @@ -34,7 +34,7 @@ class Client extends CoreClient
*
* @var string
*/
const VERSION = '4.0.0';
const VERSION = '5.0.0';

/**
* Check for an exact version.
Expand Down Expand Up @@ -64,7 +64,7 @@ class Client extends CoreClient
*
* @return bool
*/
public static function checkExact($version)
public static function checkExact(string $version): bool
{
return substr(self::VERSION, 0, strlen($version)) == $version;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public static function checkExact($version)
*
* @return bool
*/
public static function checkMinimal($version)
public static function checkMinimal(string $version): bool
{
return version_compare(self::VERSION, $version, '>=');
}
Expand Down
20 changes: 11 additions & 9 deletions src/Component/AbstractComponent.php
Expand Up @@ -3,6 +3,7 @@
namespace Solarium\Component;

use Solarium\Component\RequestBuilder\ComponentRequestBuilderInterface;
use Solarium\Component\ResponseParser\ComponentParserInterface;
use Solarium\Core\Configurable;
use Solarium\Core\Query\AbstractQuery;
use Solarium\Core\Query\Helper;
Expand All @@ -29,13 +30,14 @@ abstract public function getType(): string;
*
* @return ComponentRequestBuilderInterface
*/
abstract public function getRequestBuilder();
abstract public function getRequestBuilder(): ComponentRequestBuilderInterface;

/**
* This component has no response parser...
*/
public function getResponseParser()
public function getResponseParser(): ?ComponentParserInterface
{
return null;
}

/**
Expand All @@ -45,7 +47,7 @@ public function getResponseParser()
*
* @return self Provides fluent interface
*/
public function setQueryInstance(AbstractQuery $instance)
public function setQueryInstance(AbstractQuery $instance): self
{
$this->queryInstance = $instance;

Expand All @@ -55,9 +57,9 @@ public function setQueryInstance(AbstractQuery $instance)
/**
* Get parent query instance.
*
* @return AbstractQuery
* @return AbstractQuery|null
*/
public function getQueryInstance()
public function getQueryInstance(): ?AbstractQuery
{
return $this->queryInstance;
}
Expand All @@ -67,12 +69,12 @@ public function getQueryInstance()
*
* @return \Solarium\Core\Query\Helper
*/
public function getHelper()
public function getHelper(): Helper
{
if ($queryInstance = $this->getQueryInstance()) {
return $this->getQueryInstance()->getHelper();
} else {
return new Helper();
return $queryInstance->getHelper();
}

return new Helper();
}
}
10 changes: 5 additions & 5 deletions src/Component/ComponentAwareQueryInterface.php
Expand Up @@ -97,14 +97,14 @@ public function getComponentTypes();
*
* @return self Provides fluent interface
*/
public function registerComponentType($key, $component);
public function registerComponentType(string $key, string $component);

/**
* Get all registered components.
*
* @return AbstractComponent[]
*/
public function getComponents();
public function getComponents(): array;

/**
* Get a component instance by key.
Expand All @@ -121,7 +121,7 @@ public function getComponents();
*
* @return object|null
*/
public function getComponent($key, $autoload = false, $config = null);
public function getComponent(string $key, $autoload = false, array $config = null);

/**
* Set a component instance.
Expand All @@ -133,7 +133,7 @@ public function getComponent($key, $autoload = false, $config = null);
*
* @return self Provides fluent interface
*/
public function setComponent($key, $component);
public function setComponent(string $key, AbstractComponent $component): self;

/**
* Remove a component instance.
Expand All @@ -144,5 +144,5 @@ public function setComponent($key, $component);
*
* @return self Provides fluent interface
*/
public function removeComponent($component);
public function removeComponent($component): self;
}
20 changes: 13 additions & 7 deletions src/Component/ComponentAwareQueryTrait.php
Expand Up @@ -41,7 +41,7 @@ public function getComponentTypes()
*
* @return self Provides fluent interface
*/
public function registerComponentType($key, $component)
public function registerComponentType(string $key, string $component): ComponentAwareQueryInterface
{
$this->componentTypes[$key] = $component;

Expand All @@ -53,7 +53,7 @@ public function registerComponentType($key, $component)
*
* @return AbstractComponent[]
*/
public function getComponents()
public function getComponents(): array
{
return $this->components;
}
Expand All @@ -73,11 +73,13 @@ public function getComponents()
*
* @return object|null
*/
public function getComponent($key, $autoload = false, $config = null)
public function getComponent(string $key, $autoload = false, array $config = null)
{
if (isset($this->components[$key])) {
return $this->components[$key];
} elseif (true === $autoload) {
}

if (true === $autoload) {
if (!isset($this->componentTypes[$key])) {
throw new OutOfBoundsException('Cannot autoload unknown component: '.$key);
}
Expand All @@ -103,7 +105,7 @@ public function getComponent($key, $autoload = false, $config = null)
*
* @return self Provides fluent interface
*/
public function setComponent($key, $component)
public function setComponent(string $key, AbstractComponent $component): ComponentAwareQueryInterface
{
$component->setQueryInstance($this);
$this->components[$key] = $component;
Expand All @@ -120,7 +122,7 @@ public function setComponent($key, $component)
*
* @return self Provides fluent interface
*/
public function removeComponent($component)
public function removeComponent($component): ComponentAwareQueryInterface
{
if (is_object($component)) {
foreach ($this->components as $key => $instance) {
Expand All @@ -142,11 +144,15 @@ public function removeComponent($component)
* Build component instances based on config.
*
* @param array $configs
*
* @return self Provides fluent interface
*/
protected function createComponents($configs)
protected function createComponents(array $configs): ComponentAwareQueryInterface
{
foreach ($configs as $type => $config) {
$this->getComponent($type, true, $config);
}

return $this;
}
}

0 comments on commit 0e06e4d

Please sign in to comment.