Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#15343 - Improve stubs #15362

Merged
merged 34 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
329d1fa
#15343 - Add vimeo/psalm package
Jeckerson Apr 2, 2021
63e0246
#15343 - Bump ZEPHIR_VERSION
Jeckerson Apr 2, 2021
2059906
#15343 - Add stubs generation and validation
Jeckerson Apr 2, 2021
299d764
#15343 - Add Zephir install step
Jeckerson Apr 2, 2021
0d98eaa
#15343 - Remove limitation of branches
Jeckerson Apr 2, 2021
fac9bf8
Merge branch '5.0.x' into #15343-improve-stubs
Jeckerson Apr 2, 2021
70eaea3
#15343 - Move stubs validation into static-code-analysis.yml workflow
Jeckerson Apr 2, 2021
eb5a696
#15343 - Add 'Setup PHP' step
Jeckerson Apr 2, 2021
9b27c92
#15343 - Add 'Install Packages' step
Jeckerson Apr 2, 2021
bcf696c
#15343 - Add '--ignore-platform-reqs' flag
Jeckerson Apr 2, 2021
27a3889
#15343 - Update CHANGELOG-5.0.md
Jeckerson Apr 2, 2021
d1aea62
Rename jobs in static-code-analysis.yml
Jeckerson Apr 2, 2021
414c597
#15343 - Mass phpdoc fix
Jeckerson Apr 2, 2021
f460dd3
#15343 - Mass phpdoc fix
Jeckerson Apr 2, 2021
c6a0cfd
#15343 - Improve condition
Jeckerson Apr 4, 2021
cd13a13
#15343 - Improve condition
Jeckerson Apr 4, 2021
3b4bb88
Merge remote-tracking branch 'origin/5.0.x' into 5.0.x
Jeckerson Apr 10, 2021
40758e7
Merge branch '5.0.x' into #15343-improve-stubs
Jeckerson Apr 10, 2021
a58ca6f
#15343 - Improve stubs
Jeckerson Apr 10, 2021
a4745fa
#15343 - Improve stubs
Jeckerson Apr 20, 2021
a1eb38b
Merge remote-tracking branch 'origin/5.0.x' into 5.0.x
Jeckerson Apr 20, 2021
284741c
Merge remote-tracking branch 'origin/5.0.x' into 5.0.x
Jeckerson Apr 24, 2021
2f1d147
Merge remote-tracking branch 'origin/5.0.x' into 5.0.x
Jeckerson Apr 26, 2021
e69d235
Merge remote-tracking branch 'origin/5.0.x' into 5.0.x
Jeckerson Apr 30, 2021
6154400
#15343 - Improve stubs + types fixes
Jeckerson Apr 30, 2021
fbf3f2c
Merge branch '5.0.x' into #15343-improve-stubs
Jeckerson Apr 30, 2021
b0dfa5e
Merge remote-tracking branch 'origin/5.0.x' into 5.0.x
Jeckerson May 1, 2021
5bddc28
Merge branch '5.0.x' into #15343-improve-stubs
Jeckerson May 1, 2021
f866382
#15343 - Refactor Support/Debug properties
Jeckerson May 1, 2021
c2e3d4d
#15343 - Fix level 8 errors
Jeckerson May 1, 2021
fd5a614
#15343 - Fix level 6 errors
Jeckerson May 2, 2021
60af4ae
#15343 - Fix level 5 errors
Jeckerson May 2, 2021
f55434d
#15343 - Revert default property values in Phalcon\Tag
Jeckerson May 2, 2021
9dbb78a
#15343 - Fix typo
Jeckerson May 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ jobs:
with:
fetch-depth: 1

- name: Install System Dependencies
run: |
sudo apt-get update --quiet --yes 1>/dev/null
sudo apt-get install --no-install-recommends -q -y re2c

- name: Get Composer Cache Directory
id: composer-cache
run: |
Expand Down
48 changes: 41 additions & 7 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ on:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
branches:
- master
- 4.0.x
- 4.1.x

jobs:
phpcs:
# To prevent build a particular commit use
# git commit -m "......... [ci skip]"
if: "!contains(github.event.head_commit.message, 'ci skip')"

runs-on: ubuntu-20.04
name: Tests code style validation
steps:
- name: Checkout Code
uses: actions/checkout@v2
Expand All @@ -26,3 +20,43 @@ jobs:

- name: Run PHP_CodeSniffer
run: docker run --rm -v $(pwd):/data cytopia/phpcs --standard=./phpcs.xml

stubs:
if: "!contains(github.event.head_commit.message, 'ci skip')"

runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php-versions: [ '7.4', '8.0' ]

name: Stubs code validation in PHP ${{ matrix.php-versions }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: pecl
extensions: mbstring, intl, json, imagick, redis, igbinary, apcu, msgpack, memcached, yaml, psr

- name: Install System Dependencies
run: |
sudo apt-get update --quiet --yes 1>/dev/null
sudo apt-get install --no-install-recommends -q -y re2c

- name: Install Packages
run: composer install --prefer-dist --ignore-platform-reqs

- name: Install Zephir
run: .ci/install-zephir.sh

- name: Validate stubs
if: always()
run: |
$HOME/bin/zephir stubs
vendor/bin/psalm ide/
5 changes: 5 additions & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Changed `Phalcon\Mvc\Model::getSchema()`, `Phalcon\Mvc\ModelInterface::getSchema()`, `Phalcon\Mvc\Model\Manager::getModelSchema()` `Phalcon\Mvc\Model\ManagerInterface::getModelSchema()` to return `string | null` so as to abide with the latest Zephir [#15411](https://github.com/phalcon/cphalcon/issues/15411)
- Changed the interpolation for the formatters to use the `Phalcon\Support\Helper\Str\Interpolate` [#15411](https://github.com/phalcon/cphalcon/issues/15411)
- Changed the exceptions thrown from factories to be more specific to their namespaces vs. the Factory generic one [#15411](https://github.com/phalcon/cphalcon/issues/15411)
- Changed `Phalcon\Mvc\Model\ManagerInterface:getRelationByAlias()` return type from `Relation|bool` to `RelationInterface|bool` [#15343](https://github.com/phalcon/cphalcon/issues/15343)

## Added
- Added `BINARY` and `VARBINARY` support for Phalcon\Db\Adapter\Mysql [#14927](https://github.com/phalcon/cphalcon/issues/14927)
Expand Down Expand Up @@ -48,3 +49,7 @@
- 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)
- Fixed `Phalcon\Flash\Session::has()` to properly check if any messages are existing [15204](https://github.com/phalcon/cphalcon/issues/15204)
- Fixed signature of `Phalcon\Forms\Element\Select::__construct()`
- Fixed signature of `Phalcon\Assets\Manager::addCss()`
- Fixed signature of `Phalcon\Assets\Manager::addJs()`
- Fixed signature of `Phalcon\Db\Adapter\AdapterInterface::execute()`, `Phalcon\Db\Adapter\AdapterInterface::fetchOne()` and `Phalcon\Db\Adapter\AdapterInterface::query()`
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"predis/predis": "^1.1",
"squizlabs/php_codesniffer": "^3.4",
"twig/twig": "~1.36",
"vimeo/psalm": "^4.7",
"vlucas/phpdotenv": "^2.5"
},
"config": {
Expand Down
4 changes: 2 additions & 2 deletions phalcon/Acl/Adapter/AdapterInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface AdapterInterface
/**
* Do a role inherit from another existing role
*/
public function addInherit(string roleName, roleToInherit) -> bool;
public function addInherit(string roleName, roleToInherits) -> bool;

/**
* Adds a role to the ACL list. Second parameter lets to inherit access data
Expand All @@ -35,7 +35,7 @@ interface AdapterInterface
* Access names can be a particular action, by example
* search, update, delete, etc or a list of them
*/
public function addComponent(componentObject, accessList) -> bool;
public function addComponent(componentValue, accessList) -> bool;

/**
* Adds access to components
Expand Down
2 changes: 1 addition & 1 deletion phalcon/Assets/Manager.zep
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class Manager extends AbstractInjectionAware
/**
* Traverses a collection calling the callback to generate its HTML
*
* @param callback callback
* @param Collection callback
* @param string type
*/
public function output(<Collection> collection, callback, type) -> string | null
Expand Down
7 changes: 5 additions & 2 deletions phalcon/Cli/Router/Route.zep
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Route implements RouteInterface
* The developer can implement any arbitrary conditions here
* If the callback returns false the route is treated as not matched
*
* @param callback callback
* @param mixed callback
*/
public function beforeMatch(var callback) -> <RouteInterface>
{
Expand Down Expand Up @@ -392,7 +392,10 @@ class Route implements RouteInterface
/**
* Reconfigure the route adding a new pattern and a set of paths
*
* @param array|string paths
* @param string pattern
* @param array|string|null paths
*
* @return void
*/
public function reConfigure(string! pattern, paths = null) -> void
{
Expand Down
5 changes: 5 additions & 0 deletions phalcon/Cli/Router/RouteInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ interface RouteInterface

/**
* Reconfigure the route adding a new pattern and a set of paths
*
* @param string pattern
* @param array|string|null paths
*
* @return void
*/
public function reConfigure(string! pattern, var paths = null) -> void;

Expand Down
3 changes: 3 additions & 0 deletions phalcon/Cli/Task.zep
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ use Phalcon\Events\ManagerInterface;
*/
class Task extends Injectable implements TaskInterface, EventsAwareInterface
{
/**
* @var ManagerInterface
*/
protected eventsManager;

/**
Expand Down
16 changes: 8 additions & 8 deletions phalcon/DataMapper/Pdo/Connection/AbstractConnection.zep
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface;
abstract class AbstractConnection implements ConnectionInterface
{
/**
* @var PDO
* @var \PDO
*/
protected pdo;

Expand Down Expand Up @@ -395,7 +395,7 @@ abstract class AbstractConnection implements ConnectionInterface
/**
* Return the inner PDO (if any)
*
* @return PDO
* @return \PDO
*/
public function getAdapter() -> <\PDO>
{
Expand Down Expand Up @@ -562,7 +562,7 @@ abstract class AbstractConnection implements ConnectionInterface
* @param string $statement
* @param array $values
*
* @return PDOStatement
* @return \PDOStatement
*/
public function perform(
string statement,
Expand Down Expand Up @@ -592,7 +592,7 @@ abstract class AbstractConnection implements ConnectionInterface
* @param string $statement
* @param array $options
*
* @return PDOStatement|false
* @return \PDOStatement|false
*/
public function prepare(
string statement,
Expand All @@ -618,7 +618,7 @@ abstract class AbstractConnection implements ConnectionInterface
* @param string $statement
* @param mixed ...$fetch
*
* @return PDOStatement|false
* @return \PDOStatement|false
*/
public function query(string statement) -> <\PDOStatement> | bool
{
Expand Down Expand Up @@ -725,9 +725,9 @@ abstract class AbstractConnection implements ConnectionInterface
/**
* Bind a value using the proper PDO::PARAM_* type.
*
* @param PDOStatement $statement
* @param mixed $name
* @param mixed $arguments
* @param \PDOStatement $statement
* @param mixed $name
* @param mixed $arguments
*/
protected function performBind(
<\PDOStatement> statement,
Expand Down
4 changes: 2 additions & 2 deletions phalcon/DataMapper/Pdo/Connection/ConnectionInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ interface ConnectionInterface extends PdoInterface
/**
* Return the inner PDO (if any)
*
* @return PDO
* @return \PDO
*/
public function getAdapter() -> <\PDO>;

Expand All @@ -199,7 +199,7 @@ interface ConnectionInterface extends PdoInterface
* @param string $statement
* @param array $values
*
* @return PDOStatement
* @return \PDOStatement
*/
public function perform(string statement, array values = []) -> <\PDOStatement>;

Expand Down
2 changes: 1 addition & 1 deletion phalcon/DataMapper/Pdo/Connection/Decorated.zep
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Decorated extends AbstractConnection
* This overrides the parent so that it can take an existing PDO instance
* and decorate it with the extended methods.
*
* @param PDO $pdo
* @param \PDO $pdo
* @param ProfilerInterface|null $profiler
*
*/
Expand Down
4 changes: 2 additions & 2 deletions phalcon/DataMapper/Pdo/Connection/PdoInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ interface PdoInterface
* @param string $statement
* @param array $options
*
* @return PDOStatement|false
* @return \PDOStatement|false
*/
public function prepare(string statement, array options = []) -> <\PDOStatement> | bool;

Expand All @@ -112,7 +112,7 @@ interface PdoInterface
* @param string $statement
* @param mixed ...$fetch
*
* @return PDOStatement|false
* @return \PDOStatement|false
*/
public function query(string statement) -> <\PDOStatement> | bool;

Expand Down
74 changes: 73 additions & 1 deletion phalcon/DataMapper/Pdo/Profiler/MemoryLogger.zep
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,83 @@ class MemoryLogger extends AbstractLogger
*
* @return array
*/
public function getMessages()
public function getMessages() -> array
{
return this->messages;
}

/**
* @param string message
* @param mixed[] context
*/
public function emergency(var message, array context = [])
{
parent::emergency(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function alert(var message, array context = [])
{
parent::alert(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function critical(var message, array context = [])
{
parent::critical(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function error(var message, array context = [])
{
parent::error(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function warning(var message, array context = [])
{
parent::warning(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function notice(var message, array context = [])
{
parent::notice(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function info(var message, array context = [])
{
parent::info(message, context);
}

/**
* @param string message
* @param mixed[] context
*/
public function debug(var message, array context = [])
{
parent::debug(message, context);
}

/**
* Logs a message.
*
Expand Down
2 changes: 1 addition & 1 deletion phalcon/DataMapper/Query/AbstractQuery.zep
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ abstract class AbstractQuery
/**
* Performs a statement in the connection
*
* @return PDOStatement
* @return \PDOStatement
*/
public function perform()
{
Expand Down
4 changes: 2 additions & 2 deletions phalcon/DataMapper/Query/Insert.zep
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Insert extends AbstractQuery
*
* @param string $column
*
* @return this
* @return Insert
*/
public function column(string column, var value = null, int type = -1) -> <Insert>
{
Expand All @@ -59,7 +59,7 @@ class Insert extends AbstractQuery
*
* @param array $columns
*
* @return this
* @return Insert
*/
public function columns(array columns) -> <Insert>
{
Expand Down
Loading