Skip to content

Commit

Permalink
Merge pull request #15351 from niden/T15345-underscore-methods
Browse files Browse the repository at this point in the history
T15345 underscore methods
  • Loading branch information
niden authored Mar 28, 2021
2 parents 2c1f69b + 0ca3ca3 commit 01d24f9
Show file tree
Hide file tree
Showing 12 changed files with 3,126 additions and 3,470 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
- Fixed `Phalcon\Mvc\Model::average()` to return `float` value when is `string` [#15287](https://github.com/phalcon/cphalcon/pull/15287)
- Fixed `Phalcon\Storage\Serializer\Igbinary` to store `is_numeric` and `bool` values properly [#15240](https://github.com/phalcon/cphalcon/pull/15240)
- Fixed `Phalcon\Validation\Validator\Confirmation` was failing to compare cases such as 000123 = 123 [#15347](https://github.com/phalcon/cphalcon/pull/15347)
- Fixed declarations for `function getEventsManager()` to allow null return
- Fixed declarations for `function getEventsManager()` to allow null return [15010](https://github.com/phalcon/cphalcon/issues/15010)
- Removed underscore from method names (starting) to abide with PSR-12 [15345](https://github.com/phalcon/cphalcon/issues/15345)
5 changes: 3 additions & 2 deletions docker/7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ RUN apt update -y && apt install -y \
pecl install apcu && \
pecl install yaml && \
pecl install imagick && \
pecl install memcached
pecl install memcached && \
pecl install xdebug

RUN curl -s https://raw.githubusercontent.com/phalcon/zephir/development/.ci/install-zephir-parser.sh | bash

RUN docker-php-ext-install zip gmp gd intl pdo_mysql pdo_pgsql && \
docker-php-ext-enable psr redis igbinary msgpack apcu imagick yaml memcached
docker-php-ext-enable psr redis igbinary msgpack apcu imagick yaml memcached xdebug

COPY --from=composer /usr/bin/composer /usr/local/bin/composer

Expand Down
5 changes: 3 additions & 2 deletions docker/8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ RUN apt update -y && apt install -y \
pecl install msgpack && \
pecl install apcu && \
pecl install yaml && \
pecl install memcached
pecl install memcached && \
pecl install xdebug

# Remove this RUN when imagick will be available via pecl
RUN cd /opt && \
Expand All @@ -40,7 +41,7 @@ RUN cd /opt && \
curl -s https://raw.githubusercontent.com/phalcon/zephir/development/.ci/install-zephir-parser.sh | bash

RUN docker-php-ext-install zip gmp gd intl pdo_mysql pdo_pgsql && \
docker-php-ext-enable psr redis igbinary msgpack apcu imagick yaml memcached
docker-php-ext-enable psr redis igbinary msgpack apcu imagick yaml memcached xdebug

COPY --from=composer /usr/bin/composer /usr/local/bin/composer

Expand Down
30 changes: 4 additions & 26 deletions phalcon/DataMapper/Pdo/Profiler/Profiler.zep
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,11 @@ class Profiler implements ProfilerInterface
*/
public function finish(string statement = null, array values = []) -> void
{
var ex, finish, version;
var ex, finish;

if unlikely this->active {
let version = phpversion(),
ex = new Exception();

/**
* @todo Remove this check when we target min PHP 7.3
*/
if starts_with(version, "7.2") {
let finish = microtime(true);
} else {
let finish = hrtime(true);
}
let ex = new Exception(),
finish = hrtime(true);


let this->context["backtrace"] = ex->getTraceAsString(),
Expand Down Expand Up @@ -197,23 +188,10 @@ class Profiler implements ProfilerInterface
*/
public function start(string method) -> void
{
var start, version;

if unlikely this->active {
let version = phpversion();

/**
* @todo Remove this check when we target min PHP 7.3
*/
if starts_with(version, "7.2") {
let start = microtime(true);
} else {
let start = hrtime(true);
}

let this->context = [
"method" : method,
"start" : start
"start" : hrtime(true)
];
}
}
Expand Down
29 changes: 5 additions & 24 deletions phalcon/Db/Profiler.zep
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Profiler
*/
public function startProfile(string sqlStatement, var sqlVariables = null, var sqlBindTypes = null) -> <Profiler>
{
var activeProfile, version;
var activeProfile;

let activeProfile = new Item();

Expand All @@ -147,16 +147,7 @@ class Profiler
activeProfile->setSqlBindTypes(sqlBindTypes);
}

let version = phpversion();

/**
* @todo Remove this check when we target min PHP 7.3
*/
if starts_with(version, "7.2") {
activeProfile->setInitialTime(microtime(true));
} else {
activeProfile->setInitialTime(hrtime(true));
}
activeProfile->setInitialTime(hrtime(true));

if method_exists(this, "beforeStartProfile") {
this->{"beforeStartProfile"}(activeProfile);
Expand All @@ -172,20 +163,10 @@ class Profiler
*/
public function stopProfile() -> <Profiler>
{
var activeProfile, finalTime, initialTime, version;

let version = phpversion();

/**
* @todo Remove this check when we target min PHP 7.3
*/
if starts_with(version, "7.2") {
let finalTime = microtime(true);
} else {
let finalTime = hrtime(true);
}
var activeProfile, finalTime, initialTime;

let activeProfile = <Item> this->activeProfile;
let finalTime = hrtime(true),
activeProfile = <Item> this->activeProfile;

activeProfile->setFinalTime(finalTime);

Expand Down
64 changes: 18 additions & 46 deletions phalcon/Http/Cookie.zep
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Cookie extends AbstractInjectionAware implements CookieInterface
/**
* @var bool
*/
protected secure;
protected secure = true;

/**
* The cookie's sign key.
Expand Down Expand Up @@ -99,7 +99,7 @@ class Cookie extends AbstractInjectionAware implements CookieInterface
string path = "/",
bool secure = null,
string domain = null,
bool httpOnly = false,
bool httpOnly = null,
array options = []
) {
let this->name = name,
Expand Down Expand Up @@ -128,8 +128,7 @@ class Cookie extends AbstractInjectionAware implements CookieInterface
*/
public function delete()
{
var container, domain, httpOnly, name, options, path, secure,
session, version;
var container, domain, httpOnly, name, options, path, secure, session;

let name = this->name,
domain = this->domain,
Expand All @@ -147,32 +146,15 @@ class Cookie extends AbstractInjectionAware implements CookieInterface
}
}

let this->value = null;
let this->value = null,
options = this->options,
options["expires"] = Arr::get(options, "expires", time() - 691200),
options["domain"] = Arr::get(options, "domain", domain),
options["path"] = Arr::get(options, "path", path),
options["secure"] = Arr::get(options, "secure", secure),
options["httponly"] = Arr::get(options, "httponly", httpOnly);

/**
* @todo Remove this check when we target min PHP 7.3
*/
let version = phpversion();
if starts_with(version, "7.2") {
setcookie(
name,
null,
time() - 691200,
path,
domain,
secure,
httpOnly
);
} else {
let options = this->options,
options["expires"] = Arr::get(options, "expires", time() - 691200),
options["domain"] = Arr::get(options, "domain", domain),
options["path"] = Arr::get(options, "path", path),
options["secure"] = Arr::get(options, "secure", secure),
options["httponly"] = Arr::get(options, "httponly", httpOnly);

setcookie(name, null, options);
}
setcookie(name, null, options);
}

/**
Expand Down Expand Up @@ -421,7 +403,7 @@ class Cookie extends AbstractInjectionAware implements CookieInterface
public function send() -> <CookieInterface>
{
var container, crypt, definition, encryptValue, expire, domain, httpOnly,
name, options, path, secure, session, signKey, value, version;
name, options, path, secure, session, signKey, value;

let name = this->name,
value = this->value,
Expand Down Expand Up @@ -514,23 +496,13 @@ class Cookie extends AbstractInjectionAware implements CookieInterface
/**
* Sets the cookie using the standard 'setcookie' function
*/
/**
* @todo Remove this check when we target min PHP 7.3
*/
let version = phpversion();
if starts_with(version, "7.2") {
setcookie(name, encryptValue, expire, path, domain, secure, httpOnly);
} else {
let options["expires"] = Arr::get(options, "expires", expire),
options["domain"] = Arr::get(options, "domain", domain),
options["path"] = Arr::get(options, "path", path),
options["secure"] = Arr::get(options, "secure", secure),
options["httponly"] = Arr::get(options, "httponly", httpOnly);

setcookie(name, encryptValue, options);
}

let options["expires"] = Arr::get(options, "expires", expire),
options["domain"] = Arr::get(options, "domain", domain),
options["path"] = Arr::get(options, "path", path),
options["secure"] = Arr::get(options, "secure", secure),
options["httponly"] = Arr::get(options, "httponly", httpOnly);

setcookie(name, encryptValue, options);

return this;
}
Expand Down
Loading

0 comments on commit 01d24f9

Please sign in to comment.