Skip to content

Commit

Permalink
Merge pull request #2125 from phalcon/development
Browse files Browse the repository at this point in the history
0.12.20
  • Loading branch information
AlexNDRmac authored Dec 16, 2020
2 parents 4345593 + fe810f5 commit 4db83b4
Show file tree
Hide file tree
Showing 114 changed files with 532 additions and 590 deletions.
2 changes: 1 addition & 1 deletion .ci/vsenv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ rem See: https://help.github.com/en/articles/development-tools-for-github-action
rem See: https://stackoverflow.com/questions/39183272/loop-through-all-environmental-variables-and-take-actions-depending-on-prefix
setlocal
for /f "delims== tokens=1,2" %%a in ('set') do (
echo ::set-env name=%%a::%%b
powershell -Command "& {Write-Output '%%a=%%b' | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append;}"
)
endlocal
4 changes: 2 additions & 2 deletions .ci/win-ci-tools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ function InitializeReleaseVars {

$env:RELEASE_DLL_PATH = "${env:GITHUB_WORKSPACE}\ext\${env:RELEASE_FOLDER}\${env:EXTENSION_FILE}"

Write-Output "::set-env name=RELEASE_ZIPBALL::${env:RELEASE_ZIPBALL}"
Write-Output "::set-env name=RELEASE_DLL_PATH::${env:RELEASE_DLL_PATH}"
Write-Output "RELEASE_ZIPBALL=${env:RELEASE_ZIPBALL}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "RELEASE_DLL_PATH=${env:RELEASE_DLL_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}

function EnableTestExtension {
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
analysis:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04

steps:
- name: Checkout Code
Expand All @@ -23,16 +23,20 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '7.4'
coverage: none
tools: php-cs-fixer, phpcs

- name: Run PHP_CodeSniffer
run: phpcs --runtime-set ignore_warnings_on_exit true
run: |
phpcs --version
phpcs --runtime-set ignore_warnings_on_exit true
- name: Run PHP CS Fixer
if: always()
run: php-cs-fixer fix --diff --dry-run -v
run: |
php-cs-fixer --version
php-cs-fixer fix --diff --dry-run -v
- name: Run Shell Check
if: always()
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/build-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ env:

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

name: "${{ matrix.os }}: PHP v${{ matrix.php }}"
runs-on: ${{ matrix.os }}

Expand All @@ -27,19 +31,11 @@ jobs:
# - macos-latest

php:
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'

include:
- php: '7.0'
symfony_phpunit: '6.5'

- php: '7.1'
symfony_phpunit: '7.4'

- php: '7.2'
symfony_phpunit: '7.4'

Expand Down Expand Up @@ -80,7 +76,7 @@ jobs:
- name: Set Environment Variables
run: |
echo ::set-env name=SYMFONY_PHPUNIT_VERSION::${{ matrix.symfony_phpunit }}
echo "SYMFONY_PHPUNIT_VERSION=${{ matrix.symfony_phpunit }}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v2
Expand Down Expand Up @@ -204,7 +200,6 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
yml: ./.codecov.yml
name: codecov-umbrella
flags: unittests
fail_ci_if_error: false
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ jobs:

- name: Set Environment Variables
run: |
echo "::set-env name=SYMFONY_PHPUNIT_VERSION::${{ matrix.symfony_phpunit }}"
echo "::set-env name=PHP_VERSION::$(php -r 'echo phpversion();')"
echo "::set-env name=PHP_MINOR::${{ matrix.php }}"
echo "::set-env name=TEST_PHP_EXECUTABLE::${env:PHPROOT}\php.exe"
echo "::set-env name=BUILD_TYPE::${{ matrix.build_type }}"
echo "::set-env name=VC_VERSION::${{ matrix.vc_num }}"
echo "::set-env name=PHP_ARCH::${{ matrix.arch }}"
Write-Output "SYMFONY_PHPUNIT_VERSION=${{ matrix.symfony_phpunit }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_VERSION=$(php -r 'echo phpversion();')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_MINOR=${{ matrix.php }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "TEST_PHP_EXECUTABLE=${env:PHPROOT}\php.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "BUILD_TYPE=${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "VC_VERSION=${{ matrix.vc_num }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "PHP_ARCH=${{ matrix.arch }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Checkout Code
uses: actions/checkout@v2
Expand Down Expand Up @@ -127,10 +127,10 @@ jobs:
shell: powershell
run: |
$v = "${env:WindowsSDKVersion}" -replace '\\$', ''
Write-Output "::set-env name=WindowsSDKVersion::$v"
Write-Output "WindowsSDKVersion=$v" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$v = "${env:WindowsSDKLibVersion}" -replace '\\$', ''
Write-Output "::set-env name=WindowsSDKLibVersion::$v"
Write-Output "WindowsSDKLibVersion=$v" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Get Composer Cache Directory
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04

steps:
- name: Setup Environment Variables
Expand Down
2 changes: 2 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ $finder = PhpCsFixer\Finder::create()
'ext',
'ide',
'templates/ZendEngine3',
'templates/Api',
'tests/fixtures',
'tests/sharness',
])
Expand All @@ -50,4 +51,5 @@ return PhpCsFixer\Config::create()
'phpdoc_var_annotation_correct_order' => true,
'no_superfluous_phpdoc_tags' => false,
'single_line_throw' => false,
'psr_autoloading' => false,
]);
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased]
## [0.12.20] - 2020-12-16
### Added
- Added supports void type return value for stubs
[phalcon/ide-stubs#50](https://github.com/phalcon/ide-stubs/pull/50)
[#1977](https://github.com/phalcon/zephir/issues/1977)

### Fixed
- Fixed missing kernel directory at build time [ice/framework#271](https://github.com/ice/framework/issues/271)
- Fixed stubs generation for case with array declaration with square brackets in params
- Fixed parameters positioning for `implode()` php function [#2120](https://github.com/phalcon/zephir/issues/2120)

## [0.12.19] - 2020-05-13
### Fixed
- Fixed duplicate definition with GCC 10
Expand Down Expand Up @@ -410,7 +421,8 @@ and this project adheres to [Semantic Versioning](http://semver.org).
- Fixed casting resource to int (only ZendEngine 3)
[#1524](https://github.com/phalcon/zephir/issues/1524)

[Unreleased]: https://github.com/phalcon/zephir/compare/0.12.19...HEAD
[Unreleased]: https://github.com/phalcon/zephir/compare/0.12.20...HEAD
[0.12.20]: https://github.com/phalcon/zephir/compare/0.12.19...0.12.20
[0.12.19]: https://github.com/phalcon/zephir/compare/0.12.18...0.12.19
[0.12.18]: https://github.com/phalcon/zephir/compare/0.12.17...0.12.18
[0.12.17]: https://github.com/phalcon/zephir/compare/0.12.16...0.12.17
Expand Down
2 changes: 1 addition & 1 deletion Library/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ public function compile($development = false)
$hasChanged = false;

if (false === strpos($configureFile, $fixMarker)) {
$configureFile = $fixMarker.PHP_EOL.implode($configureFix, PHP_EOL).PHP_EOL.$configureFile;
$configureFile = $fixMarker.PHP_EOL.implode(PHP_EOL, $configureFix).PHP_EOL.$configureFile;
$hasChanged = true;
}

Expand Down
2 changes: 1 addition & 1 deletion Library/CompilerFileAnonymous.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private function compileClass(CompilationContext $compilationContext)
}

if (\count($this->headerCBlocks) > 0) {
$code .= implode($this->headerCBlocks, PHP_EOL).PHP_EOL;
$code .= implode(PHP_EOL, $this->headerCBlocks).PHP_EOL;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion Library/Expression/PropertyDynamicAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function compile($expression, CompilationContext $compilationContext)

$compilationContext->headersManager->add('kernel/object');

$property = $propertyVariable ? $propertyVariable : add_slashes($expression['right']['value']);
$property = $propertyVariable ?: add_slashes($expression['right']['value']);
$compilationContext->backend->fetchProperty($symbolVariable, $variableVariable, $property, false, $compilationContext);

return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function optimize(array $expression, Call $call, CompilationContext $cont

return new CompiledExpression('bool', 'zephir_is_private_prop('.$resolvedParams[0].')', $expression);
} catch (Exception $e) {
throw new CompilerException($e->getMessage(), $expression);
throw new CompilerException($e->getMessage(), $expression);
}
}
}
2 changes: 1 addition & 1 deletion Library/StatementsBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function compile(CompilationContext $compilationContext, $unreachable = f
* Reference the block if it belongs to a loop
*/
if ($this->loop) {
array_push($compilationContext->cycleBlocks, $this);
$compilationContext->cycleBlocks[] = $this;
}

$where = '';
Expand Down
3 changes: 3 additions & 0 deletions Library/Stubs/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ protected function buildMethod(ClassMethod $method, bool $isInterface, string $i
if ($supported > 1) {
$return = '';
}
} elseif (version_compare(PHP_VERSION, '7.1.0', '>=') && $method->isVoid()) {
$return = 'void';
}

if (!empty($return)) {
$return = ': '.$return;
}
Expand Down
2 changes: 1 addition & 1 deletion Library/Stubs/MethodDocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function parseDocBlockParam(string $line): array
{
$pattern = '~
@(?P<doctype>param|return|var)\s+
(?P<type>[\\\\\w]+(:?\s*\|\s*[\\\\\w]+)*)\s*
(?P<type>[\\\\\w]+(:?\s*\|\s*[\\\\\w]+|\s*\[]+)*)\s*
(?P<dollar>\$)?
(?P<name>[a-z_][a-z0-9_]*)?\s*
(?P<description>(.|\s)*)?
Expand Down
2 changes: 1 addition & 1 deletion Library/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private function areReturnTypesCompatible(array $types, array $allowedTypes, boo
$areEquals = false;

if ($isNullable) {
array_push($allowedTypes, static::T_NULL);
$allowedTypes[] = static::T_NULL;
}

foreach ($types as $type => $data) {
Expand Down
2 changes: 1 addition & 1 deletion Library/Zephir.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
final class Zephir
{
const VERSION = '0.12.19-$Id$';
const VERSION = '0.12.20-$Id$';

const LOGO = <<<'ASCII'
_____ __ _
Expand Down
10 changes: 5 additions & 5 deletions ext/php_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
#define PHP_STUB_VERSION "1.0.0"
#define PHP_STUB_EXTNAME "stub"
#define PHP_STUB_AUTHOR "Phalcon Team and contributors"
#define PHP_STUB_ZEPVERSION "0.12.19-$Id$"
#define PHP_STUB_ZEPVERSION "0.12.20-$Id$"
#define PHP_STUB_DESCRIPTION "Description <b>test</b> for<br/>Test Extension."

typedef struct _zephir_struct_db {
typedef struct _zephir_struct_db {
zend_bool my_setting_1;
int my_setting_2;
double my_setting_3;
} zephir_struct_db;

typedef struct _zephir_struct_orm {
typedef struct _zephir_struct_orm {
int cache_level;
zend_bool cache_enable;
} zephir_struct_orm;

typedef struct _zephir_struct_extension {
typedef struct _zephir_struct_extension {
zend_bool test_ini_variable;
} zephir_struct_extension;

Expand All @@ -49,7 +49,7 @@ ZEND_BEGIN_MODULE_GLOBALS(stub)
/* Max recursion control */
unsigned int recursive_lock;


zephir_struct_db db;

zephir_struct_orm orm;
Expand Down
10 changes: 5 additions & 5 deletions stub/mcall.zep
Original file line number Diff line number Diff line change
Expand Up @@ -208,27 +208,27 @@ class Mcall
/**
* @link https://github.com/phalcon/zephir/issues/142
*/
public function arrayParamWithDefaultEmptyArray(array driverOptions = [])
public function testArrayParamWithDefaultEmptyArray(array driverOptions = [])
{
return driverOptions;
}

public function arrayParamWithDefaultNullValue(array driverOptions = null)
public function testArrayParamWithDefaultNullValue(array driverOptions = null)
{
return driverOptions;
}

public function arrayParam(array driverOptions)
public function testArrayParam(array driverOptions)
{
return driverOptions;
}

public function objectParamCastStdClass(<\StdClass> param)
public function testObjectParamCastStdClass(<\StdClass> param)
{
return param;
}

public function objectParamCastOoParam(<Oo\Param> param)
public function testObjectParamCastOoParam(<Oo\Param> param)
{
return param;
}
Expand Down
4 changes: 2 additions & 2 deletions stub/oo/oonativeimplements.zep
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class OoNativeImplements implements
\Iterator,
\OuterIterator,
\RecursiveIterator,
\SeekableIterator,
\IteratorAggregate
\SeekableIterator
// \IteratorAggregate
{

/* Countable */
Expand Down
2 changes: 2 additions & 0 deletions templates/ZendEngine3/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if test "$PHP_%PROJECT_UPPER%" = "yes"; then
AC_DEFINE(HAVE_%PROJECT_UPPER%, 1, [Whether you have %PROJECT_CAMELIZE%])
%PROJECT_LOWER%_sources="%PROJECT_LOWER_SAFE%.c kernel/main.c kernel/memory.c kernel/exception.c kernel/debug.c kernel/backtrace.c kernel/object.c kernel/array.c kernel/string.c kernel/fcall.c kernel/require.c kernel/file.c kernel/operators.c kernel/math.c kernel/concat.c kernel/variables.c kernel/filter.c kernel/iterator.c kernel/time.c kernel/exit.c %FILES_COMPILED% %EXTRA_FILES_COMPILED%"
PHP_NEW_EXTENSION(%PROJECT_LOWER%, $%PROJECT_LOWER%_sources, $ext_shared,, %PROJECT_EXTRA_CFLAGS%)
PHP_ADD_BUILD_DIR([$ext_builddir/kernel/])
PHP_ADD_BUILD_DIR([$ext_builddir/%PROJECT_LOWER%/])
PHP_SUBST(%PROJECT_UPPER%_SHARED_LIBADD)

old_CPPFLAGS=$CPPFLAGS
Expand Down
2 changes: 1 addition & 1 deletion tests/Extension/ArithmeticTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ArithmeticTest extends TestCase
{
protected $class;

public function setUp()
protected function setUp(): void
{
$this->class = new \Stub\Arithmetic();
}
Expand Down
8 changes: 3 additions & 5 deletions tests/Extension/ArraySearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ class ArraySearchTest extends TestCase
/** @var ArraySearch */
private $test;

public function setUp()
protected function setUp(): void
{
$this->test = new ArraySearch();
}

/**
* @test
* @issue https://github.com/phalcon/zephir/issues/1609
*/
public function shouldSearchInTheExternalArrayForAGivenValueAndReturnTheFirstCorrespondingKey()
public function testShouldSearchInTheExternalArrayForAGivenValueAndReturnTheFirstCorrespondingKey()
{
$needle = 'value';
$haystack = ['.', '/', '0', '1', '2', '3', '4', 'value', 'OtherValue'];
Expand All @@ -37,10 +36,9 @@ public function shouldSearchInTheExternalArrayForAGivenValueAndReturnTheFirstCor
}

/**
* @test
* @issue https://github.com/phalcon/zephir/issues/1609
*/
public function shouldSearchInTheInternalArrayForAGivenValueAndReturnTheFirstCorrespondingKey()
public function testShouldSearchInTheInternalArrayForAGivenValueAndReturnTheFirstCorrespondingKey()
{
$this->assertEquals(7, $this->test->searchUsingArrayInsideZephir());
}
Expand Down
Loading

0 comments on commit 4db83b4

Please sign in to comment.