Skip to content

Commit

Permalink
BC break: rename Object to BaseObject for PHP 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
graste committed Jan 30, 2018
1 parent 2c61c0b commit b2a4107
Show file tree
Hide file tree
Showing 31 changed files with 71 additions and 73 deletions.
4 changes: 2 additions & 2 deletions src/CodeGen/ClassBuilder/BuildCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Trellis\CodeGen\ClassBuilder;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\Common\Error\NotReadableException;
use Trellis\Common\Error\RuntimeException;
use Trellis\Common\Error\NotWritableException;
use Symfony\Component\Filesystem\Filesystem;

class BuildCache extends Object
class BuildCache extends BaseObject
{
const CHECKSUM_FILE = '.checksum';

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/ClassBuilder/ClassBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Trellis\CodeGen\ClassBuilder;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Twig_Environment;
use Twig_Loader_Filesystem;

abstract class ClassBuilder extends Object implements ClassBuilderInterface
abstract class ClassBuilder extends BaseObject implements ClassBuilderInterface
{
protected $twig;

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/ClassBuilder/ClassContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Trellis\CodeGen\ClassBuilder;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;

class ClassContainer extends Object implements ClassContainerInterface
class ClassContainer extends BaseObject implements ClassContainerInterface
{
protected $file_name;

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/ClassBuilder/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Trellis\CodeGen\ClassBuilder;

use Trellis\CodeGen\Config;
use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\CodeGen\Schema\EntityTypeSchema;
use Trellis\CodeGen\Schema\EntityTypeDefinition;
use Trellis\CodeGen\ClassBuilder\Common\BaseEntityTypeClassBuilder;
Expand All @@ -19,7 +19,7 @@
use Trellis\CodeGen\ClassBuilder\Reference\BaseReferenceEntityClassBuilder;
use Trellis\CodeGen\ClassBuilder\Reference\ReferenceEntityClassBuilder;

class Factory extends Object
class Factory extends BaseObject
{
protected $type_schema;

Expand Down
6 changes: 3 additions & 3 deletions src/CodeGen/Parser/Config/ConfigIniParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

use Trellis\CodeGen\Config;
use Trellis\CodeGen\Parser\ParserInterface;
use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\Common\Error\InvalidConfigException;
use Trellis\Common\Error\NotReadableException;
use Trellis\Common\Error\NotWritableException;
use Trellis\Common\Error\InvalidConfigException;
use Trellis\Common\Error\ParseException;

class ConfigIniParser extends Object implements ParserInterface
class ConfigIniParser extends BaseObject implements ParserInterface
{
public function parse($ini_file, array $options = [])
{
Expand Down
8 changes: 4 additions & 4 deletions src/CodeGen/Parser/Schema/EntityTypeSchemaXmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace Trellis\CodeGen\Parser\Schema;

use Trellis\CodeGen\Parser\ParserInterface;
use Trellis\Common\Object;
use Trellis\Common\Error\ParseException;
use Trellis\Common\Error\FileSystemException;
use Trellis\CodeGen\Schema\EntityTypeSchema;
use Trellis\Common\BaseObject;
use Trellis\Common\Error\FileSystemException;
use Trellis\Common\Error\ParseException;

class EntityTypeSchemaXmlParser extends Object implements ParserInterface
class EntityTypeSchemaXmlParser extends BaseObject implements ParserInterface
{
const BASE_DOCUMENT = '\Trellis\Runtime\Entity\Entity';

Expand Down
8 changes: 4 additions & 4 deletions src/CodeGen/Parser/Schema/XpathParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Trellis\CodeGen\Parser\Schema;

use Trellis\Common\Object;
use DOMElement;
use DOMXPath;
use Trellis\CodeGen\Parser\ParserInterface;
use Trellis\Common\BaseObject;
use Trellis\Common\Error\InvalidTypeException;
use Trellis\Common\Error\RuntimeException;
use DOMXPath;
use DOMElement;

abstract class XpathParser extends Object implements ParserInterface
abstract class XpathParser extends BaseObject implements ParserInterface
{
abstract protected function parseXpath(DOMXPath $xpath, DOMElement $context);

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/Schema/AttributeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Trellis\CodeGen\Schema;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;

class AttributeDefinition extends Object
class AttributeDefinition extends BaseObject
{
protected $name;

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/Schema/EntityTypeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Trellis\CodeGen\Schema;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;

class EntityTypeDefinition extends Object
class EntityTypeDefinition extends BaseObject
{
protected $name;

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/Schema/EntityTypeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Trellis\CodeGen\Schema;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;

class EntityTypeSchema extends Object
class EntityTypeSchema extends BaseObject
{
protected $self_uri;

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/Schema/OptionDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Trellis\CodeGen\Schema;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;

class OptionDefinition extends Object
class OptionDefinition extends BaseObject
{
protected $name;

Expand Down
4 changes: 2 additions & 2 deletions src/CodeGen/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Trellis\CodeGen;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\CodeGen\Schema\EntityTypeSchema;
use Trellis\CodeGen\ClassBuilder\Factory;
use Trellis\CodeGen\ClassBuilder\ClassContainerList;
use Trellis\CodeGen\ClassBuilder\BuildCache;

class Service extends Object
class Service extends BaseObject
{
protected $config;

Expand Down
10 changes: 5 additions & 5 deletions src/Common/Object.php → src/Common/BaseObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use ReflectionClass;
use Traversable;

class Object implements ObjectInterface
class BaseObject implements BaseObjectInterface
{
const OBJECT_TYPE = '@type';

Expand Down Expand Up @@ -41,7 +41,7 @@ public function __construct(array $state = [])
* Return an array representation of the current object.
* The array will contain the object's property names as keys
* and the property values as array values.
* Nested 'ObjectInterface' and 'Options' instances will also be turned into arrays.
* Nested 'BaseObjectInterface' and 'Options' instances will also be turned into arrays.
*
* @return array
*/
Expand All @@ -50,7 +50,7 @@ public function toArray()
return $this->extractData($this);
}

protected function extractData(ObjectInterface $object)
protected function extractData(BaseObjectInterface $object)
{
$data = [ self::OBJECT_TYPE => get_class($object) ];
$hidden_properties = $object->getHiddenProperties();
Expand All @@ -61,11 +61,11 @@ protected function extractData(ObjectInterface $object)
}

$data[$prop] = $value;
if ($value instanceof ObjectInterface) {
if ($value instanceof BaseObjectInterface) {
$data[$prop] = $value->toArray();
} elseif (is_array($value) || $value instanceof Traversable) {
foreach ($value as $nested_prop => $nested_value) {
if ($nested_value instanceof ObjectInterface) {
if ($nested_value instanceof BaseObjectInterface) {
$data[$prop][$nested_prop] = $this->extractData($nested_value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Trellis\Common;

interface ObjectInterface
interface BaseObjectInterface
{
public function toArray();
}
10 changes: 5 additions & 5 deletions src/Common/Collection/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Trellis\Common\Collection;

use Trellis\Common\Error\RuntimeException;
use Trellis\Common\Object;
use Trellis\Common\ObjectInterface;
use ArrayIterator;
use Trellis\Common\BaseObject;
use Trellis\Common\BaseObjectInterface;
use Trellis\Common\Error\RuntimeException;

/**
* Generic base implementation of the CollectionInterface interface.
*/
abstract class Collection extends Object implements CollectionInterface
abstract class Collection extends BaseObject implements CollectionInterface
{
/**
* An array of ListenerInterface that are notified upon collection changes.
Expand Down Expand Up @@ -316,7 +316,7 @@ public function toArray()
{
$data = [];
foreach ($this->items as $key => $value) {
if ($value instanceof ObjectInterface) {
if ($value instanceof BaseObjectInterface) {
$value = $value->toArray();
}
$data[$key] = $value;
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Collection/CollectionChangedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Trellis\Common\Collection;

use Trellis\Common\BaseObject;
use Trellis\Common\EventInterface;
use Trellis\Common\Object;

class CollectionChangedEvent extends Object implements EventInterface
class CollectionChangedEvent extends BaseObject implements EventInterface
{
const ITEM_ADDED = 'added';

Expand Down
6 changes: 3 additions & 3 deletions src/Common/Configurable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

namespace Trellis\Common;

use Trellis\Common\BaseObject;
use Trellis\Common\ConfigurableInterface;
use Trellis\Common\Object;
use Trellis\Common\Options;
use Trellis\Common\OptionsInterface;

class Configurable extends Object implements ConfigurableInterface
class Configurable extends BaseObject implements ConfigurableInterface
{
/**
* @var Options $options
*/
protected $options;

/**
* Override the Object's constructor to always initialize options.
* Override the BaseObject's constructor to always initialize options.
* To set options on this instance use the special key 'options'.
*
* @param array $state data to set on the object (key-value pairs)
Expand Down
6 changes: 3 additions & 3 deletions src/Common/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace Trellis\Common;

use ArrayObject;
use Trellis\Common\Error\BadValueException;
use Trellis\Common\Error\RuntimeException;
use JmesPath\Env as JmesPath;
use JsonSerializable;
use Trellis\Common\Error\BadValueException;
use Trellis\Common\Error\RuntimeException;

class Options extends ArrayObject implements ObjectInterface, OptionsInterface, JsonSerializable
class Options extends ArrayObject implements BaseObjectInterface, OptionsInterface, JsonSerializable
{
/**
* @var string default iterator used
Expand Down
6 changes: 3 additions & 3 deletions src/Runtime/Attribute/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Trellis\Runtime\Attribute;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\Common\Error\BadValueException;
use Trellis\Common\Error\InvalidTypeException;
use Trellis\Common\Error\InvalidConfigException;
Expand All @@ -20,10 +20,10 @@
* provide validation rules that sanitize the given attribute value.
*
* basic options: 'validator', 'value', 'default_value', 'null_value', 'mandatory'
* @todo extends Object; which introduces a breaking change to the create method.
* @todo extends BaseObject; which introduces a breaking change to the create method.
* TODO introduce 'mandatory' option
*/
abstract class Attribute extends Object implements AttributeInterface
abstract class Attribute extends BaseObject implements AttributeInterface
{
/**
* Holds a reference to the attribute's type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace Trellis\Runtime\Attribute\EmbeddedEntityList;

use Trellis\Common\Object;
use Trellis\Runtime\EntityTypeMap;
use Trellis\Runtime\Entity\EntityInterface;
use Trellis\Runtime\Entity\EntityList;
use Trellis\Runtime\Validator\Result\IncidentInterface;
use Trellis\Runtime\Validator\Rule\Rule;
use Trellis\Runtime\EntityTypeMap;

/**
* Validates that a given (array) value consistently translates to a list of entities.
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/Entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Closure;
use Trellis\Common\Error\RuntimeException;
use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\Runtime\EntityTypeInterface;
use Trellis\Runtime\Entity\EntityMap;
use Trellis\Runtime\Validator\Result\IncidentInterface;
Expand All @@ -23,7 +23,7 @@
* and serves as a parent/ancestor to all generated and domain specific entity base-classes.
* It provides generic value access via it's getValue(s) and setValue(s) methods.
*/
abstract class Entity extends Object implements EntityInterface, ValueChangedListenerInterface, JsonSerializable
abstract class Entity extends BaseObject implements EntityInterface, ValueChangedListenerInterface, JsonSerializable
{
/**
* Holds the entity's type.
Expand Down
1 change: 0 additions & 1 deletion src/Runtime/Entity/Transform/SpecificationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Trellis\Runtime\Entity\Transform;

use Trellis\Common\ConfigurableInterface;
use Trellis\Common\Object;

interface SpecificationInterface extends ConfigurableInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/Validator/Result/Incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Trellis\Runtime\Validator\Result;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;

class Incident extends Object implements IncidentInterface
class Incident extends BaseObject implements IncidentInterface
{
protected $name;

Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/Validator/Result/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Trellis\Runtime\Validator\Result;

use Trellis\Common\Object;
use Trellis\Common\BaseObject;
use Trellis\Runtime\Validator\Rule\RuleInterface;
use Trellis\Runtime\Validator\Rule\RuleList;
use Trellis\Runtime\Validator\ValidatorInterface;

class Result extends Object implements ResultInterface
class Result extends BaseObject implements ResultInterface
{
protected $subject;

Expand Down
Loading

0 comments on commit b2a4107

Please sign in to comment.