diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index ff1b79b47ad..c118924d2f7 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -1,4 +1,7 @@ # [4.0.0-rc.2](https://github.com/phalcon/cphalcon/releases/tag/v4.0.0-rc.2) (2019-XX-XX) +## Changed +- Changed all calls to `new ` to use the `create_instance` or `create_instance_params` for better performance. [#14419](https://github.com/phalcon/cphalcon/pull/14419) + ## Fixed - Fixed `Phalcon\Mvc\View\Engine\Volt\Compiler::parse()` Corrected syntax recognize for "set" keyword. [#14288](https://github.com/phalcon/cphalcon/issues/14288) - Fixed `Phalcon\Mvc\View\Engine\Volt\Compiler::parse()` Corrected syntax recognize for "is" keyword. [#11683](https://github.com/phalcon/cphalcon/issues/11683) diff --git a/build/README.md b/build/README.md index d6e3f102940..305f479ceed 100644 --- a/build/README.md +++ b/build/README.md @@ -52,4 +52,4 @@ Please, refer to [Phalcon documentation](https://phalcon.link/docs) ## Building extension for Windows -Please, refer to [Phalcon Internals documentation](https://internals.phalconphp.com) +Please, refer to [PHP's step by step guide](https://wiki.php.net/internals/windows/stepbystepbuild) diff --git a/composer.json b/composer.json index e42de104e96..f029ec20f2f 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ { "name": "Phalcon Team", "email": "team@phalcon.io", - "homepage": "https://phalconphp.com/en/team" + "homepage": "https://phalcon.io/en/team" }, { "name": "Contributors", diff --git a/phalcon/Annotations/AnnotationsFactory.zep b/phalcon/Annotations/AnnotationsFactory.zep index 8fb0091c182..2b8a6f43212 100644 --- a/phalcon/Annotations/AnnotationsFactory.zep +++ b/phalcon/Annotations/AnnotationsFactory.zep @@ -55,7 +55,12 @@ class AnnotationsFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(options); + this->services[name] = create_instance_params( + definition, + [ + options + ] + ); } return this->services[name]; @@ -67,9 +72,9 @@ class AnnotationsFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "apcu" : "\\Phalcon\\Annotations\\Adapter\\Apcu", - "memory" : "\\Phalcon\\Annotations\\Adapter\\Memory", - "stream" : "\\Phalcon\\Annotations\\Adapter\\Stream" + "apcu" : "Phalcon\\Annotations\\Adapter\\Apcu", + "memory" : "Phalcon\\Annotations\\Adapter\\Memory", + "stream" : "Phalcon\\Annotations\\Adapter\\Stream" ]; } } diff --git a/phalcon/Cache/AdapterFactory.zep b/phalcon/Cache/AdapterFactory.zep index d749ebbbe54..d62c58f24b3 100644 --- a/phalcon/Cache/AdapterFactory.zep +++ b/phalcon/Cache/AdapterFactory.zep @@ -46,7 +46,13 @@ class AdapterFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(this->serializerFactory, options); + this->services[name] = create_instance_params( + definition, + [ + this->serializerFactory, + options + ] + ); } return this->services[name]; @@ -58,11 +64,11 @@ class AdapterFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "apcu" : "\\Phalcon\\Cache\\Adapter\\Apcu", - "libmemcached" : "\\Phalcon\\Cache\\Adapter\\Libmemcached", - "memory" : "\\Phalcon\\Cache\\Adapter\\Memory", - "redis" : "\\Phalcon\\Cache\\Adapter\\Redis", - "stream" : "\\Phalcon\\Cache\\Adapter\\Stream" + "apcu" : "Phalcon\\Cache\\Adapter\\Apcu", + "libmemcached" : "Phalcon\\Cache\\Adapter\\Libmemcached", + "memory" : "Phalcon\\Cache\\Adapter\\Memory", + "redis" : "Phalcon\\Cache\\Adapter\\Redis", + "stream" : "Phalcon\\Cache\\Adapter\\Stream" ]; } } diff --git a/phalcon/Config/ConfigFactory.zep b/phalcon/Config/ConfigFactory.zep index 51e0f3006ff..3137cf4ebb0 100644 --- a/phalcon/Config/ConfigFactory.zep +++ b/phalcon/Config/ConfigFactory.zep @@ -113,18 +113,20 @@ class ConfigFactory extends AbstractFactory */ public function newInstance(string name, string fileName, var params = null) -> object { - var definition; + var definition, options; this->checkService(name); if !isset this->services[name] { - let definition = this->mapper[name]; + let definition = this->mapper[name], + options = [], + options[] = fileName; - if "json" === name || "php" === name { - let this->services[name] = new {definition}(fileName); - } else { - let this->services[name] = new {definition}(fileName, params); + if "json" !== name && "php" !== name { + let options[] = params; } + + let this->services[name] = create_instance_params(definition, options); } return this->services[name]; @@ -136,11 +138,11 @@ class ConfigFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "grouped" : "\\Phalcon\\Config\\Adapter\\Grouped", - "ini" : "\\Phalcon\\Config\\Adapter\\Ini", - "json" : "\\Phalcon\\Config\\Adapter\\Json", - "php" : "\\Phalcon\\Config\\Adapter\\Php", - "yaml" : "\\Phalcon\\Config\\Adapter\\Yaml" + "grouped" : "Phalcon\\Config\\Adapter\\Grouped", + "ini" : "Phalcon\\Config\\Adapter\\Ini", + "json" : "Phalcon\\Config\\Adapter\\Json", + "php" : "Phalcon\\Config\\Adapter\\Php", + "yaml" : "Phalcon\\Config\\Adapter\\Yaml" ]; } } diff --git a/phalcon/Db/Adapter/AbstractAdapter.zep b/phalcon/Db/Adapter/AbstractAdapter.zep index c9a11f54e9e..5b8575ad9d4 100644 --- a/phalcon/Db/Adapter/AbstractAdapter.zep +++ b/phalcon/Db/Adapter/AbstractAdapter.zep @@ -124,7 +124,7 @@ abstract class AbstractAdapter implements AdapterInterface, EventsAwareInterface * Create the instance only if the dialect is a string */ if typeof dialectClass == "string" { - let this->dialect = new {dialectClass}(); + let this->dialect = create_instance(dialectClass); } elseif typeof dialectClass == "object" { let this->dialect = dialectClass; } diff --git a/phalcon/Db/Adapter/PdoFactory.zep b/phalcon/Db/Adapter/PdoFactory.zep index 57933e883fb..189042ef1fb 100644 --- a/phalcon/Db/Adapter/PdoFactory.zep +++ b/phalcon/Db/Adapter/PdoFactory.zep @@ -52,7 +52,12 @@ class PdoFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(options); + this->services[name] = create_instance_params( + definition, + [ + options + ] + ); } return this->services[name]; @@ -64,9 +69,9 @@ class PdoFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "mysql" : "\\Phalcon\\Db\\Adapter\\Pdo\\Mysql", - "postgresql" : "\\Phalcon\\Db\\Adapter\\Pdo\\Postgresql", - "sqlite" : "\\Phalcon\\Db\\Adapter\\Pdo\\Sqlite" + "mysql" : "Phalcon\\Db\\Adapter\\Pdo\\Mysql", + "postgresql" : "Phalcon\\Db\\Adapter\\Pdo\\Postgresql", + "sqlite" : "Phalcon\\Db\\Adapter\\Pdo\\Sqlite" ]; } } diff --git a/phalcon/Filter/FilterFactory.zep b/phalcon/Filter/FilterFactory.zep index 458fd494323..f37d557cd06 100644 --- a/phalcon/Filter/FilterFactory.zep +++ b/phalcon/Filter/FilterFactory.zep @@ -29,27 +29,27 @@ class FilterFactory protected function getAdapters() -> array { return [ - "absint" : "\\Phalcon\\Filter\\Sanitize\\AbsInt", - "alnum" : "\\Phalcon\\Filter\\Sanitize\\Alnum", - "alpha" : "\\Phalcon\\Filter\\Sanitize\\Alpha", - "bool" : "\\Phalcon\\Filter\\Sanitize\\BoolVal", - "email" : "\\Phalcon\\Filter\\Sanitize\\Email", - "float" : "\\Phalcon\\Filter\\Sanitize\\FloatVal", - "int" : "\\Phalcon\\Filter\\Sanitize\\IntVal", - "lower" : "\\Phalcon\\Filter\\Sanitize\\Lower", - "lowerFirst" : "\\Phalcon\\Filter\\Sanitize\\LowerFirst", - "regex" : "\\Phalcon\\Filter\\Sanitize\\Regex", - "remove" : "\\Phalcon\\Filter\\Sanitize\\Remove", - "replace" : "\\Phalcon\\Filter\\Sanitize\\Replace", - "special" : "\\Phalcon\\Filter\\Sanitize\\Special", - "specialFull" : "\\Phalcon\\Filter\\Sanitize\\SpecialFull", - "string" : "\\Phalcon\\Filter\\Sanitize\\StringVal", - "striptags" : "\\Phalcon\\Filter\\Sanitize\\Striptags", - "trim" : "\\Phalcon\\Filter\\Sanitize\\Trim", - "upper" : "\\Phalcon\\Filter\\Sanitize\\Upper", - "upperFirst" : "\\Phalcon\\Filter\\Sanitize\\UpperFirst", - "upperWords" : "\\Phalcon\\Filter\\Sanitize\\UpperWords", - "url" : "\\Phalcon\\Filter\\Sanitize\\Url" + "absint" : "Phalcon\\Filter\\Sanitize\\AbsInt", + "alnum" : "Phalcon\\Filter\\Sanitize\\Alnum", + "alpha" : "Phalcon\\Filter\\Sanitize\\Alpha", + "bool" : "Phalcon\\Filter\\Sanitize\\BoolVal", + "email" : "Phalcon\\Filter\\Sanitize\\Email", + "float" : "Phalcon\\Filter\\Sanitize\\FloatVal", + "int" : "Phalcon\\Filter\\Sanitize\\IntVal", + "lower" : "Phalcon\\Filter\\Sanitize\\Lower", + "lowerFirst" : "Phalcon\\Filter\\Sanitize\\LowerFirst", + "regex" : "Phalcon\\Filter\\Sanitize\\Regex", + "remove" : "Phalcon\\Filter\\Sanitize\\Remove", + "replace" : "Phalcon\\Filter\\Sanitize\\Replace", + "special" : "Phalcon\\Filter\\Sanitize\\Special", + "specialFull" : "Phalcon\\Filter\\Sanitize\\SpecialFull", + "string" : "Phalcon\\Filter\\Sanitize\\StringVal", + "striptags" : "Phalcon\\Filter\\Sanitize\\Striptags", + "trim" : "Phalcon\\Filter\\Sanitize\\Trim", + "upper" : "Phalcon\\Filter\\Sanitize\\Upper", + "upperFirst" : "Phalcon\\Filter\\Sanitize\\UpperFirst", + "upperWords" : "Phalcon\\Filter\\Sanitize\\UpperWords", + "url" : "Phalcon\\Filter\\Sanitize\\Url" ]; } } diff --git a/phalcon/Html/TagFactory.zep b/phalcon/Html/TagFactory.zep index 7388d13a711..f138e22ff5b 100644 --- a/phalcon/Html/TagFactory.zep +++ b/phalcon/Html/TagFactory.zep @@ -48,7 +48,12 @@ class TagFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(this->escaper); + this->services[name] = create_instance_params( + definition, + [ + this->escaper + ] + ); } return this->services[name]; @@ -57,17 +62,17 @@ class TagFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "a" : "\\Phalcon\\Html\\Helper\\Anchor", - "aRaw" : "\\Phalcon\\Html\\Helper\\AnchorRaw", - "body" : "\\Phalcon\\Html\\Helper\\Body", - "button" : "\\Phalcon\\Html\\Helper\\Button", - "close" : "\\Phalcon\\Html\\Helper\\Close", - "element" : "\\Phalcon\\Html\\Helper\\Element", - "elementRaw" : "\\Phalcon\\Html\\Helper\\ElementRaw", - "form" : "\\Phalcon\\Html\\Helper\\Form", - "img" : "\\Phalcon\\Html\\Helper\\Img", - "label" : "\\Phalcon\\Html\\Helper\\Label", - "textarea" : "\\Phalcon\\Html\\Helper\\TextArea" + "a" : "Phalcon\\Html\\Helper\\Anchor", + "aRaw" : "Phalcon\\Html\\Helper\\AnchorRaw", + "body" : "Phalcon\\Html\\Helper\\Body", + "button" : "Phalcon\\Html\\Helper\\Button", + "close" : "Phalcon\\Html\\Helper\\Close", + "element" : "Phalcon\\Html\\Helper\\Element", + "elementRaw" : "Phalcon\\Html\\Helper\\ElementRaw", + "form" : "Phalcon\\Html\\Helper\\Form", + "img" : "Phalcon\\Html\\Helper\\Img", + "label" : "Phalcon\\Html\\Helper\\Label", + "textarea" : "Phalcon\\Html\\Helper\\TextArea" ]; } } diff --git a/phalcon/Image/ImageFactory.zep b/phalcon/Image/ImageFactory.zep index db29b2504f7..45516da8fa1 100644 --- a/phalcon/Image/ImageFactory.zep +++ b/phalcon/Image/ImageFactory.zep @@ -70,7 +70,14 @@ class ImageFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(file, width, height); + this->services[name] = create_instance_params( + definition, + [ + file, + width, + height + ] + ); } return this->services[name]; @@ -79,8 +86,8 @@ class ImageFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "gd" : "\\Phalcon\\Image\\Adapter\\Gd", - "imagick" : "\\Phalcon\\Image\\Adapter\\Imagick" + "gd" : "Phalcon\\Image\\Adapter\\Gd", + "imagick" : "Phalcon\\Image\\Adapter\\Imagick" ]; } } diff --git a/phalcon/Logger/Adapter/AbstractAdapter.zep b/phalcon/Logger/Adapter/AbstractAdapter.zep index 5b2d5f14af5..624f05c1103 100644 --- a/phalcon/Logger/Adapter/AbstractAdapter.zep +++ b/phalcon/Logger/Adapter/AbstractAdapter.zep @@ -114,7 +114,7 @@ abstract class AbstractAdapter implements AdapterInterface if typeof this->formatter !== "object" { let className = "Phalcon\\Logger\\Formatter\\" . this->defaultFormatter; - let this->formatter = new {className}(); + let this->formatter = create_instance(className); } return this->formatter; diff --git a/phalcon/Logger/AdapterFactory.zep b/phalcon/Logger/AdapterFactory.zep index e3644598769..44af77068b8 100644 --- a/phalcon/Logger/AdapterFactory.zep +++ b/phalcon/Logger/AdapterFactory.zep @@ -38,7 +38,13 @@ class AdapterFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(fileName, options); + this->services[name] = create_instance_params( + definition, + [ + fileName, + options + ] + ); } return this->services[name]; @@ -47,9 +53,9 @@ class AdapterFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "noop" : "\\Phalcon\\Logger\\Adapter\\Noop", - "stream" : "\\Phalcon\\Logger\\Adapter\\Stream", - "syslog" : "\\Phalcon\\Logger\\Adapter\\Syslog" + "noop" : "Phalcon\\Logger\\Adapter\\Noop", + "stream" : "Phalcon\\Logger\\Adapter\\Stream", + "syslog" : "Phalcon\\Logger\\Adapter\\Syslog" ]; } } diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index 307a92b0dc3..3fea4047fb9 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -3135,7 +3135,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, * Create a message */ this->appendMessage( - new Message(message, fields, "ConstraintViolation") + new Message( + message, + fields, + "ConstraintViolation" + ) ); let error = true; @@ -3378,7 +3382,11 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, * Create a message */ this->appendMessage( - new Message(message, fields, "ConstraintViolation") + new Message( + message, + fields, + "ConstraintViolation" + ) ); let error = true; @@ -4247,7 +4255,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, ); } - let model = new {modelName}(), + let model = create_instance(modelName), metaData = model->getModelsMetaData(); /** diff --git a/phalcon/Mvc/Model/Criteria.zep b/phalcon/Mvc/Model/Criteria.zep index 68d4db13809..86b0c030074 100644 --- a/phalcon/Mvc/Model/Criteria.zep +++ b/phalcon/Mvc/Model/Criteria.zep @@ -720,9 +720,14 @@ class Criteria implements CriteriaInterface, InjectionAwareInterface let conditions = []; if count(data) { - let metaData = container->getShared("modelsMetadata"); - - let model = new {modelName}(null, container), + let metaData = container->getShared("modelsMetadata"), + model = create_instance_params( + modelName, + [ + null, + container + ] + ), dataTypes = metaData->getDataTypes(model), columnMap = metaData->getReverseColumnMap(model); diff --git a/phalcon/Mvc/Model/Manager.zep b/phalcon/Mvc/Model/Manager.zep index 736ec8b3f48..cf40dbbbc4d 100644 --- a/phalcon/Mvc/Model/Manager.zep +++ b/phalcon/Mvc/Model/Manager.zep @@ -282,7 +282,14 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI /** * Load it using an autoloader */ - let model = new {modelName}(null, this->container, this); + let model = create_instance_params( + modelName, + [ + null, + this->container, + this + ] + ); return model; } diff --git a/phalcon/Mvc/Model/Query.zep b/phalcon/Mvc/Model/Query.zep index c8d69b8e807..1fc3521dd6e 100644 --- a/phalcon/Mvc/Model/Query.zep +++ b/phalcon/Mvc/Model/Query.zep @@ -3165,12 +3165,15 @@ class Query implements QueryInterface, InjectionAwareInterface ); } - return new {resultsetClassName}( - simpleColumnMap, - resultObject, - resultData, - cache, - isKeepingSnapshots + return create_instance_params( + resultsetClassName, + [ + simpleColumnMap, + resultObject, + resultData, + cache, + isKeepingSnapshots + ] ); } } @@ -3190,7 +3193,11 @@ class Query implements QueryInterface, InjectionAwareInterface /** * Complex resultsets may contain complete objects and scalars */ - return new Complex(columns1, resultData, cache); + return new Complex( + columns1, + resultData, + cache + ); } /** diff --git a/phalcon/Mvc/Model/Query/Builder.zep b/phalcon/Mvc/Model/Query/Builder.zep index ade02b3f20e..9cb6a130fd8 100644 --- a/phalcon/Mvc/Model/Query/Builder.zep +++ b/phalcon/Mvc/Model/Query/Builder.zep @@ -650,8 +650,14 @@ class Builder implements BuilderInterface, InjectionAwareInterface * Get the models metadata service to obtain the column names, * column map and primary key */ - let metaData = container->getShared("modelsMetadata"), - modelInstance = new {model}(null, container); + let metaData = container->getShared("modelsMetadata"), + modelInstance = create_instance_params( + model, + [ + null, + container + ] + ); let noPrimary = true, primaryKeys = metaData->getPrimaryKeyAttributes(modelInstance); diff --git a/phalcon/Paginator/Adapter/QueryBuilder.zep b/phalcon/Paginator/Adapter/QueryBuilder.zep index b6949185773..58195f09d47 100644 --- a/phalcon/Paginator/Adapter/QueryBuilder.zep +++ b/phalcon/Paginator/Adapter/QueryBuilder.zep @@ -65,7 +65,10 @@ class QueryBuilder extends AbstractAdapter throw new Exception("Parameter 'builder' is required"); } if unlikely !(builder instanceof Builder) { - throw new Exception("Parameter 'builder' must be an instance of Phalcon\Mvc\Model\Query\Builder"); + throw new Exception( + "Parameter 'builder' must be an instance " . + "of Phalcon\\Mvc\\Model\\Query\\Builder" + ); } if fetch columns, config["columns"] { @@ -221,9 +224,9 @@ class QueryBuilder extends AbstractAdapter let modelClass = array_values(modelClass)[0]; } - let model = new {modelClass}(); - let dbService = model->getReadConnectionService(); - let db = totalBuilder->getDI()->get(dbService); + let model = create_instance(modelClass), + dbService = model->getReadConnectionService(), + db = totalBuilder->getDI()->get(dbService); let row = db->fetchOne( "SELECT COUNT(*) as \"rowcount\" FROM (" . sql["sql"] . ") as T1", diff --git a/phalcon/Paginator/PaginatorFactory.zep b/phalcon/Paginator/PaginatorFactory.zep index 2a9967ffba6..0225a982e56 100644 --- a/phalcon/Paginator/PaginatorFactory.zep +++ b/phalcon/Paginator/PaginatorFactory.zep @@ -69,7 +69,12 @@ class PaginatorFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(options); + this->services[name] = create_instance_params( + definition, + [ + options + ] + ); } return this->services[name]; @@ -78,9 +83,9 @@ class PaginatorFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "model" : "\\Phalcon\\Paginator\\Adapter\\Model", - "nativeArray" : "\\Phalcon\\Paginator\\Adapter\\NativeArray", - "queryBuilder" : "\\Phalcon\\Paginator\\Adapter\\QueryBuilder" + "model" : "Phalcon\\Paginator\\Adapter\\Model", + "nativeArray" : "Phalcon\\Paginator\\Adapter\\NativeArray", + "queryBuilder" : "Phalcon\\Paginator\\Adapter\\QueryBuilder" ]; } } diff --git a/phalcon/Storage/AdapterFactory.zep b/phalcon/Storage/AdapterFactory.zep index 47b514f535d..eac89b32ef0 100644 --- a/phalcon/Storage/AdapterFactory.zep +++ b/phalcon/Storage/AdapterFactory.zep @@ -42,7 +42,13 @@ class AdapterFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(this->serializerFactory, options); + this->services[name] = create_instance_params( + definition, + [ + this->serializerFactory, + options + ] + ); } return this->services[name]; @@ -51,11 +57,11 @@ class AdapterFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "apcu" : "\\Phalcon\\Storage\\Adapter\\Apcu", - "libmemcached" : "\\Phalcon\\Storage\\Adapter\\Libmemcached", - "memory" : "\\Phalcon\\Storage\\Adapter\\Memory", - "redis" : "\\Phalcon\\Storage\\Adapter\\Redis", - "stream" : "\\Phalcon\\Storage\\Adapter\\Stream" + "apcu" : "Phalcon\\Storage\\Adapter\\Apcu", + "libmemcached" : "Phalcon\\Storage\\Adapter\\Libmemcached", + "memory" : "Phalcon\\Storage\\Adapter\\Memory", + "redis" : "Phalcon\\Storage\\Adapter\\Redis", + "stream" : "Phalcon\\Storage\\Adapter\\Stream" ]; } } diff --git a/phalcon/Storage/SerializerFactory.zep b/phalcon/Storage/SerializerFactory.zep index 26816683425..79aa0db72a9 100644 --- a/phalcon/Storage/SerializerFactory.zep +++ b/phalcon/Storage/SerializerFactory.zep @@ -39,7 +39,7 @@ class SerializerFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(); + this->services[name] = create_instance(definition); } return this->services[name]; @@ -48,12 +48,12 @@ class SerializerFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "base64" : "\\Phalcon\\Storage\\Serializer\\Base64", - "igbinary" : "\\Phalcon\\Storage\\Serializer\\Igbinary", - "json" : "\\Phalcon\\Storage\\Serializer\\Json", - "msgpack" : "\\Phalcon\\Storage\\Serializer\\Msgpack", - "none" : "\\Phalcon\\Storage\\Serializer\\None", - "php" : "\\Phalcon\\Storage\\Serializer\\Php" + "base64" : "Phalcon\\Storage\\Serializer\\Base64", + "igbinary" : "Phalcon\\Storage\\Serializer\\Igbinary", + "json" : "Phalcon\\Storage\\Serializer\\Json", + "msgpack" : "Phalcon\\Storage\\Serializer\\Msgpack", + "none" : "Phalcon\\Storage\\Serializer\\None", + "php" : "Phalcon\\Storage\\Serializer\\Php" ]; } } diff --git a/phalcon/Text.zep b/phalcon/Text.zep index 606c83a7814..1524af5def8 100644 --- a/phalcon/Text.zep +++ b/phalcon/Text.zep @@ -67,7 +67,7 @@ class Text let args = func_get_args(); - return call_user_func_array("\\Phalcon\\Helper\\Str::concat", args); + return call_user_func_array("Phalcon\\Helper\\Str::concat", args); } /** diff --git a/phalcon/Translate/InterpolatorFactory.zep b/phalcon/Translate/InterpolatorFactory.zep index 9050fa9a2fd..92a7c73ae91 100644 --- a/phalcon/Translate/InterpolatorFactory.zep +++ b/phalcon/Translate/InterpolatorFactory.zep @@ -44,7 +44,7 @@ class InterpolatorFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(); + this->services[name] = create_instance(definition); } return this->services[name]; @@ -53,8 +53,8 @@ class InterpolatorFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "associativeArray" : "\\Phalcon\\Translate\\Interpolator\\AssociativeArray", - "indexedArray" : "\\Phalcon\\Translate\\Interpolator\\IndexedArray" + "associativeArray" : "Phalcon\\Translate\\Interpolator\\AssociativeArray", + "indexedArray" : "Phalcon\\Translate\\Interpolator\\IndexedArray" ]; } } diff --git a/phalcon/Translate/TranslateFactory.zep b/phalcon/Translate/TranslateFactory.zep index 9029de47de6..170ae532903 100644 --- a/phalcon/Translate/TranslateFactory.zep +++ b/phalcon/Translate/TranslateFactory.zep @@ -58,7 +58,13 @@ class TranslateFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(this->interpolator, options); + this->services[name] = create_instance_params( + definition, + [ + this->interpolator, + options + ] + ); } return this->services[name]; @@ -67,9 +73,9 @@ class TranslateFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "csv" : "\\Phalcon\\Translate\\Adapter\\Csv", - "gettext" : "\\Phalcon\\Translate\\Adapter\\Gettext", - "array" : "\\Phalcon\\Translate\\Adapter\\NativeArray" + "csv" : "Phalcon\\Translate\\Adapter\\Csv", + "gettext" : "Phalcon\\Translate\\Adapter\\Gettext", + "array" : "Phalcon\\Translate\\Adapter\\NativeArray" ]; } } diff --git a/phalcon/Validation/ValidatorFactory.zep b/phalcon/Validation/ValidatorFactory.zep index 251ee61e00f..8c84fc6ed41 100644 --- a/phalcon/Validation/ValidatorFactory.zep +++ b/phalcon/Validation/ValidatorFactory.zep @@ -34,7 +34,7 @@ class ValidatorFactory extends AbstractFactory if !isset this->services[name] { let definition = this->mapper[name], - this->services[name] = new {definition}(); + this->services[name] = create_instance(definition); } return this->services[name]; @@ -43,27 +43,27 @@ class ValidatorFactory extends AbstractFactory protected function getAdapters() -> array { return [ - "alnum" : "\\Phalcon\\Validation\\Validator\\Alnum", - "alpha" : "\\Phalcon\\Validation\\Validator\\Alpha", - "between" : "\\Phalcon\\Validation\\Validator\\Between", - "callback" : "\\Phalcon\\Validation\\Validator\\Callback", - "confirmation" : "\\Phalcon\\Validation\\Validator\\Confirmation", - "creditCard" : "\\Phalcon\\Validation\\Validator\\CreditCard", - "date" : "\\Phalcon\\Validation\\Validator\\Date", - "digit" : "\\Phalcon\\Validation\\Validator\\Digit", - "email" : "\\Phalcon\\Validation\\Validator\\Email", - "exception" : "\\Phalcon\\Validation\\Validator\\Exception", - "exclusionIn" : "\\Phalcon\\Validation\\Validator\\ExclusionIn", - "file" : "\\Phalcon\\Validation\\Validator\\File", - "identical" : "\\Phalcon\\Validation\\Validator\\Identical", - "inclusionIn" : "\\Phalcon\\Validation\\Validator\\InclusionIn", - "ip" : "\\Phalcon\\Validation\\Validator\\Ip", - "numericality" : "\\Phalcon\\Validation\\Validator\\Numericality", - "presenceOf" : "\\Phalcon\\Validation\\Validator\\PresenceOf", - "regex" : "\\Phalcon\\Validation\\Validator\\Regex", - "stringLength" : "\\Phalcon\\Validation\\Validator\\StringLength", - "uniqueness" : "\\Phalcon\\Validation\\Validator\\Uniqueness", - "url" : "\\Phalcon\\Validation\\Validator\\Url" + "alnum" : "Phalcon\\Validation\\Validator\\Alnum", + "alpha" : "Phalcon\\Validation\\Validator\\Alpha", + "between" : "Phalcon\\Validation\\Validator\\Between", + "callback" : "Phalcon\\Validation\\Validator\\Callback", + "confirmation" : "Phalcon\\Validation\\Validator\\Confirmation", + "creditCard" : "Phalcon\\Validation\\Validator\\CreditCard", + "date" : "Phalcon\\Validation\\Validator\\Date", + "digit" : "Phalcon\\Validation\\Validator\\Digit", + "email" : "Phalcon\\Validation\\Validator\\Email", + "exception" : "Phalcon\\Validation\\Validator\\Exception", + "exclusionIn" : "Phalcon\\Validation\\Validator\\ExclusionIn", + "file" : "Phalcon\\Validation\\Validator\\File", + "identical" : "Phalcon\\Validation\\Validator\\Identical", + "inclusionIn" : "Phalcon\\Validation\\Validator\\InclusionIn", + "ip" : "Phalcon\\Validation\\Validator\\Ip", + "numericality" : "Phalcon\\Validation\\Validator\\Numericality", + "presenceOf" : "Phalcon\\Validation\\Validator\\PresenceOf", + "regex" : "Phalcon\\Validation\\Validator\\Regex", + "stringLength" : "Phalcon\\Validation\\Validator\\StringLength", + "uniqueness" : "Phalcon\\Validation\\Validator\\Uniqueness", + "url" : "Phalcon\\Validation\\Validator\\Url" ]; } } diff --git a/tests/integration/Session/Adapter/Stream/OpenCest.php b/tests/integration/Session/Adapter/Stream/OpenCest.php index 17ae20c3858..5ce5c792486 100644 --- a/tests/integration/Session/Adapter/Stream/OpenCest.php +++ b/tests/integration/Session/Adapter/Stream/OpenCest.php @@ -51,7 +51,7 @@ public function sessionAdapterStreamOpen(IntegrationTester $I) /** * Tests Phalcon\Session\Adapter\Stream :: open() * - * @author Phalcon Team + * @author Phalcon Team * @since 2019-08-06 */ public function issue14265(IntegrationTester $I) diff --git a/tests/unit/Helper/Fs/FsBasenameCest.php b/tests/unit/Helper/Fs/FsBasenameCest.php index bd18f8734e7..c4d89df43c2 100644 --- a/tests/unit/Helper/Fs/FsBasenameCest.php +++ b/tests/unit/Helper/Fs/FsBasenameCest.php @@ -4,7 +4,7 @@ /** * This file is part of the Phalcon Framework. * - * (c) Phalcon Team + * (c) Phalcon Team * * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code.