Skip to content

Commit

Permalink
Merge pull request #16066 from phalcon/#16023-event-getter
Browse files Browse the repository at this point in the history
#16023 - Improve object return type
  • Loading branch information
Jeckerson authored Aug 22, 2022
2 parents da1b48a + b87f9cc commit 446277f
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
# All versions should be declared here
PHALCON_VERSION: 5.0.0RC4
ZEPHIR_PARSER_VERSION: 1.5.0
ZEPHIR_VERSION: 0.16.0
ZEPHIR_VERSION: 0.16.2

# For tests
LANG: en_US.UTF-8
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# [x.x.x](https://github.com/phalcon/cphalcon/releases/tag/vx.x.x) (xxxx-xx-xx)

## Fixed
- Fixed and improved return type of `object` & `?object` [#16023](https://github.com/phalcon/cphalcon/issues/16023)

# [5.0.0rc4](https://github.com/phalcon/cphalcon/releases/tag/v5.0.0RC4) (2022-08-08)

## Fixed
Expand Down
2 changes: 1 addition & 1 deletion docker/7.4/.bashrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

ZEPHIR_VERSION="0.16.0"
ZEPHIR_VERSION="0.16.2"

# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
Expand Down
2 changes: 1 addition & 1 deletion docker/8.0/.bashrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

ZEPHIR_VERSION="0.16.0"
ZEPHIR_VERSION="0.16.2"

# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
Expand Down
2 changes: 1 addition & 1 deletion docker/8.1/.bashrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

ZEPHIR_VERSION="0.15.2"
ZEPHIR_VERSION="0.16.2"

# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 10 additions & 13 deletions ext/phalcon/events/event.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions ext/phalcon/events/event.zep.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ext/phalcon/http/cookie.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion ext/phalcon/mvc/micro/lazyloader.zep.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion ext/phalcon/support/helper/arr/toobject.zep.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/php_phalcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define PHP_PHALCON_VERSION "5.0.0RC4"
#define PHP_PHALCON_EXTNAME "phalcon"
#define PHP_PHALCON_AUTHOR "Phalcon Team and contributors"
#define PHP_PHALCON_ZEPVERSION "0.16.0-4fac47b"
#define PHP_PHALCON_ZEPVERSION "0.16.2-3e961ab"
#define PHP_PHALCON_DESCRIPTION "Phalcon is a full stack PHP framework, delivered as a PHP extension, offering lower resource consumption and high performance."

typedef struct _zephir_struct_db {
Expand Down
9 changes: 7 additions & 2 deletions phalcon/Events/Event.zep
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Event implements EventInterface
*
* @var object|null
*/
protected source { get };
protected source = null;

/**
* Is event propagation stopped?
Expand All @@ -67,7 +67,7 @@ class Event implements EventInterface
*/
public function __construct(string! type, var source = null, var data = null, bool cancelable = true)
{
if unlikely null !== source && typeof source != "object" {
if unlikely null !== source && typeof source !== "object" {
throw new Exception(
"The source of " . type . " event must be an object, got " . (typeof source)
);
Expand Down Expand Up @@ -100,6 +100,11 @@ class Event implements EventInterface
return this->stopped;
}

public function getSource() -> object | null
{
return this->source;
}

/**
* Sets event data.
*/
Expand Down
12 changes: 6 additions & 6 deletions phalcon/Tag.zep
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,8 @@ class Tag
}

/**
* Automatically assign the id if the name is not an array
*/
* Automatically assign the id if the name is not an array
*/
if !strpos(id, "[") {
if !isset params["id"] {
let params["id"] = id;
Expand All @@ -1502,15 +1502,15 @@ class Tag
let value = self::getValue(id, params);

/**
* Evaluate the value in POST
*/
* Evaluate the value in POST
*/
if value != null {
let params["checked"] = "checked";
}

/**
* Update the value anyways
*/
* Update the value anyways
*/
let params["value"] = value;
}

Expand Down

0 comments on commit 446277f

Please sign in to comment.