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

#914 - mysqli constructor #2212

Merged
merged 4 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip
extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr, zip, mysqli
coverage: none
# variables_order: https://github.com/zephir-lang/zephir/pull/1537
# enable_dl: https://github.com/zephir-lang/zephir/pull/1654
Expand Down
7 changes: 4 additions & 3 deletions Library/StaticCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext
}
}

/*
/**
* Include fcall header
*/
$compilationContext->headersManager->add('kernel/fcall');
Expand Down Expand Up @@ -127,10 +127,11 @@ public function compile(Expression $expr, CompilationContext $compilationContext
}
}

/*
/**
* Check if the class implements the method
*/
if (!$dynamicMethod && !$dynamicClass) {
// TODO: Consider to check instance of ClassDefinitionRuntime and throw another error, telling that class was not found.
if (!$classDefinition->hasMethod($methodName)) {
$possibleMethod = $classDefinition->getPossibleMethodName($methodName);
if ($possibleMethod) {
Expand All @@ -153,7 +154,7 @@ public function compile(Expression $expr, CompilationContext $compilationContext

if (!$classDefinition->hasMethod('__callStatic')) {
if ($method instanceof ClassMethod && !$method->isBundled()) {
/*
/**
* Try to produce an exception if method is called with a wrong number of parameters
*/
if (isset($expression['parameters'])) {
Expand Down
5 changes: 0 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# For local development only.

# First development steps after start containers:
# - .ci/install-zephir-parser.sh
# - php zephir stubs
# - cd ext/ && ./install

version: '3'

services:
Expand Down
2 changes: 1 addition & 1 deletion docker/7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt update -y && apt install -y \
libzip-dev && \
pecl install psr

RUN docker-php-ext-install zip gmp intl && \
RUN docker-php-ext-install zip gmp intl mysqli && \
docker-php-ext-enable psr

# Install Zephir parser
Expand Down
2 changes: 1 addition & 1 deletion docker/8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt update -y && apt install -y \
libzip-dev && \
pecl install psr

RUN docker-php-ext-install zip gmp intl && \
RUN docker-php-ext-install zip gmp intl mysqli && \
docker-php-ext-enable psr

# Install Zephir parser
Expand Down
9 changes: 9 additions & 0 deletions stub/issue914.zep
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Stub;

class Issue914 extends \mysqli
{
public function __construct()
{
parent::__construct();
}
}
27 changes: 27 additions & 0 deletions tests/Extension/Issue914Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* This file is part of the Zephir.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Extension;

use PHPUnit\Framework\TestCase;
use Stub\Issue914;

final class Issue914Test extends TestCase
{
public function testIssue914(): void
{
$test = new Issue914();

$this->assertInstanceOf(\mysqli::class, $test);
}
}