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

#2255 - PHP 8.1 support #2265

Merged
merged 45 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7402c4c
#2255 - Add Dockerfile with PHP8.1 and update kernel files
Jeckerson Aug 7, 2021
c595467
#2255 - Update Dockerfile's
Jeckerson Sep 7, 2021
9195f24
#2253 - Add ReturnTypeWillChange on required methods
Jeckerson Sep 7, 2021
af7cf0a
Merge branch 'development' into #2255-php8.1
Jeckerson Sep 7, 2021
b0248e1
#2253 - Fix `zephir_file_exists()` C function in PHP8.1
Jeckerson Sep 8, 2021
27c2e71
#2255 - Fix `zephir_filemtime()` C function in PHP8.1
Jeckerson Sep 8, 2021
d5cb1a0
#2255 - Add PHP 8.1 to the matrix
Jeckerson Sep 9, 2021
4070b12
#2255 - Fix `IsPhpVersionTest` test for PHP8.1
Jeckerson Sep 11, 2021
f1d67f9
#2255 - Fix signature in method of Iterator classes and interfaces
Jeckerson Sep 11, 2021
425702e
#2255 - Fix `zephir_require_ret()` C function in PHP8.1
Jeckerson Sep 11, 2021
417c147
#2255 - Fix signature in method of Iterator classes and interfaces
Jeckerson Sep 11, 2021
465d4eb
Merge branch 'development' into #2255-php8.1
Jeckerson Sep 11, 2021
7db94ed
Merge branch 'development' into #2255-php8.1
Jeckerson Sep 13, 2021
308092f
Merge branch 'development' into #2255-php8.1
Jeckerson Oct 1, 2021
68776a7
#2255 - Review Dockerfile for PHP8.1
Jeckerson Oct 1, 2021
6e4cfd4
#2255 - Review Dockerfile for PHP8.1
Jeckerson Oct 1, 2021
cd80f4e
Merge branch 'development' into #2255-php8.1
Jeckerson Oct 24, 2021
9b2cb38
Merge branch 'development' into #2255-php8.1
Jeckerson Oct 24, 2021
cba9203
#2255 - Fix `php_stream_open_for_zend_ex` for 8.1 in `zephir_require_…
Jeckerson Oct 24, 2021
c3212d4
#2255 - Add `*.dep` to .gitignore
Jeckerson Oct 24, 2021
e32a0f7
#2255 - Fix deprecation notices
Jeckerson Oct 24, 2021
a38a556
#2255 - Add support of `mixed` in arrays
Jeckerson Oct 24, 2021
a37a158
#2255 - Fix deprecation notices
Jeckerson Oct 24, 2021
70a7bfd
#2255 - Update `ext/` directory
Jeckerson Oct 24, 2021
0432d28
#2255 - Update `Dockerfile` for PHP8.1
Jeckerson Oct 24, 2021
bf51599
#2255 - Add `8.1` to the CI matrix
Jeckerson Oct 24, 2021
ac612e3
#2255 - Ignore Windows builds for 8.1
Jeckerson Oct 24, 2021
aa50a54
#2255 - Fix CS
Jeckerson Oct 24, 2021
baab26c
#2255 - Ignore Windows builds for 8.1
Jeckerson Oct 24, 2021
fea7349
#2255 - Ignore Windows builds for 8.1
Jeckerson Oct 24, 2021
fcb4484
#2255 - Ignore Windows builds for 8.1
Jeckerson Oct 24, 2021
1847b65
Merge branch 'development' into #2255-php8.1
Jeckerson Nov 7, 2021
88e76dc
#2255 - Bump PHP8.1 docker image to `RC5`
Jeckerson Nov 7, 2021
24cf1a8
#2255 - Bump PSR extension version to `1.1.0`
Jeckerson Nov 7, 2021
3a7a34f
#2255 - Bump PSR extension version to `1.2.0`
Jeckerson Dec 11, 2021
a5756d0
Merge branch 'development' into #2255-php8.1
Jeckerson Dec 11, 2021
896ba45
#2255 - Update docker image of PHP8.1
Jeckerson Dec 11, 2021
0efa65c
#2255 - Update composer dependencies
Jeckerson Dec 11, 2021
f45391b
#2255 - Adapt unit test for PHP8.1
Jeckerson Dec 11, 2021
096d525
#2255 - Minor code cleanup
Jeckerson Dec 11, 2021
d68e118
#2255 - Adapt php:8.1 with new matrix syntax
Jeckerson Dec 11, 2021
916c8b5
#2255 - Cast `int` to `bool`
Jeckerson Dec 11, 2021
db11ab7
#2255 - Simplify `ClassDefinition:hasProperty()` method
Jeckerson Dec 11, 2021
2cb019b
#2255 - Fix CS
Jeckerson Dec 11, 2021
2995a56
#2255 - Bump Zephir parser extension version to `1.4.2`
Jeckerson Dec 11, 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
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
fail-fast: false

matrix:
php: ['7.4', '8.0']
php: ['7.4', '8.0', '8.1']
build_type: ['ts', 'nts']
arch: ['x64']

Expand Down Expand Up @@ -102,6 +102,13 @@ jobs:
- name: win2016-vc15
php: '8.0'

- name: win2016-vc15
php: '8.1'

# Ignore 8.1 until its release date
- name: win2019-vs16
php: '8.1'

steps:
- uses: actions/checkout@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ doc
vendor

# Compilation artifacts.
*.dep
*.gch
*.lo
*.la
Expand Down
6 changes: 4 additions & 2 deletions Library/Backends/ZendEngine2/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA

/* Types which map to the same */
case 'variable':
case 'mixed':
case 'string':
$type = $index->getType();
break;
Expand All @@ -454,7 +455,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA
$arrayAccess['right']
);
}
if ($isVariable && \in_array($index->getType(), ['variable', 'string'])) {
if ($isVariable && \in_array($index->getType(), ['variable', 'string', 'mixed'])) {
$output = 'zephir_array_fetch('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');';
} else {
if ($isVariable) {
Expand Down Expand Up @@ -487,7 +488,7 @@ public function arrayIsset(Variable $var, $resolvedExpr, $expression, Compilatio

if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) {
return new CompiledExpression('bool', 'zephir_array_isset_long('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression);
} elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType()) {
} elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType() || 'mixed' === $resolvedExpr->getType()) {
return new CompiledExpression('bool', 'zephir_array_isset('.$this->getVariableCode($var).', '.$this->getVariableCode($resolvedExpr).')', $expression);
}

Expand Down Expand Up @@ -550,6 +551,7 @@ public function arrayUnset(Variable $variable, $exprIndex, $flags, CompilationCo

case 'string':
case 'variable':
case 'mixed':
$context->codePrinter->output('zephir_array_unset('.$variableCode.', '.$indexCode.', '.$flags.');');
break;

Expand Down
12 changes: 5 additions & 7 deletions Library/BaseBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getName()
*
* @return string
*/
public function getInternalKernelPath()
public function getInternalKernelPath(): string
{
return "$this->kernelsPath/{$this->name}";
}
Expand All @@ -76,7 +76,7 @@ public function getInternalKernelPath()
*
* @return string
*/
public function getInternalTemplatePath()
public function getInternalTemplatePath(): string
{
return "$this->templatesPath/{$this->name}";
}
Expand All @@ -88,16 +88,14 @@ public function getInternalTemplatePath()
*
* @return string
*/
public function getTemplateFileContents($filename)
public function getTemplateFileContents(string $filename): string
{
$templatePath = rtrim($this->config->get('templatepath', 'backend'), '\\/');
$templatePath = rtrim((string) $this->config->get('templatepath', 'backend'), '\\/');
if (empty($templatepath)) {
$templatePath = $this->templatesPath;
}

return file_get_contents(
"{$templatePath}/{$this->name}/{$filename}"
);
return file_get_contents("{$templatePath}/{$this->name}/{$filename}");
}

/**
Expand Down
2 changes: 2 additions & 0 deletions Library/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ public function getResolvedParams(array $parameters, CompilationContext $compila
break;

case 'variable':
case 'mixed':
$params[] = $compilationContext->backend->getVariableCode($parameterVariable);
$types[] = $parameterVariable->getType();
$dynamicTypes = array_merge(
Expand Down Expand Up @@ -636,6 +637,7 @@ public function getReadOnlyResolvedParams(array $parameters, CompilationContext

case 'string':
case 'variable':
case 'mixed':
case 'array':
$params[] = $compilationContext->backend->getVariableCode($parameterVariable);
$dynamicTypes[] = $parameterVariable->getType();
Expand Down
9 changes: 9 additions & 0 deletions Library/ClassMethodParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,46 +142,55 @@ public function count(): int
return count($this->parameters);
}

#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
}

#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}

#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->parameters[$this->position]);
}

#[\ReturnTypeWillChange]
public function current()
{
return $this->parameters[$this->position];
}

#[\ReturnTypeWillChange]
public function next()
{
++$this->position;
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->parameters[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->parameters[$offset];
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->parameters[$offset] = $value;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->parameters[$offset]);
Expand Down
21 changes: 13 additions & 8 deletions Library/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Zephir;

use ArrayAccess;
Expand Down Expand Up @@ -222,25 +224,26 @@ public function offsetExists($key): bool
/**
* Gets a $key from the internal container.
*
* @param mixed $key
* @param mixed $offset
*
* @return mixed|null
*/
public function offsetGet($key)
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!\is_array($key)) {
return $this->offsetExists($key) ? $this->container[$key] : null;
if (!\is_array($offset)) {
return $this->offsetExists($offset) ? $this->container[$offset] : null;
}

$namespace = key($key);
$key = current($key);
$namespace = key($offset);
$offset = current($offset);

if (!$this->offsetExists($namespace) || !\is_array($this->container[$namespace])) {
return null;
}

if (isset($this->container[$namespace][$key]) || \array_key_exists($key, $this->container[$namespace])) {
return $this->container[$namespace][$key];
if (isset($this->container[$namespace][$offset]) || \array_key_exists($offset, $this->container[$namespace])) {
return $this->container[$namespace][$offset];
}

return null;
Expand All @@ -252,6 +255,7 @@ public function offsetGet($key)
* @param mixed $key
* @param mixed $value
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
if (!\is_array($key)) {
Expand All @@ -277,6 +281,7 @@ public function offsetSet($key, $value)
*
* @param mixed $key
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
unset($this->container[$key]);
Expand Down
Loading