Skip to content

Commit

Permalink
Merge pull request zephir-lang#2114 from phalcon/stubs-for-array
Browse files Browse the repository at this point in the history
Stubs for array
  • Loading branch information
AlexNDRmac authored Aug 26, 2020
2 parents 0cfc742 + 5040fb0 commit a5f31d8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ jobs:
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
5 changes: 3 additions & 2 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
``<?php

/*
* This file is part of the Zephir.
Expand Down Expand Up @@ -49,5 +49,6 @@ return PhpCsFixer\Config::create()
'protected_to_private' => false,
'phpdoc_var_annotation_correct_order' => true,
'no_superfluous_phpdoc_tags' => false,
'single_line_throw' => false,
// Removed this line, because latest php-cs-fixer v2.15.x does not support this rule
// 'single_line_throw' => false,
]);
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
and this project adheres to [Semantic Versioning](http://semver.org).

## [Unreleased]
### Fixed
- Fixed stubs generation for case with array declaration with square brackets in params

## [0.12.19] - 2020-05-13
### Fixed
- Fixed duplicate definition with GCC 10
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: 2 additions & 0 deletions tests/Zephir/Stubs/DocBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function testPhpDocWithScalarParams()
* @param string \$valueString
* @param bool \$valueBoolean
* @param array \$valueArray
* @param string[] \$stringArray
* @param object \$valueObject
* @param resource \$valueResource
* @param null \$valueNull
Expand All @@ -165,6 +166,7 @@ public function testPhpDocWithScalarParams()
* @param string \$valueString
* @param bool \$valueBoolean
* @param array \$valueArray
* @param string[] \$stringArray
* @param object \$valueObject
* @param resource \$valueResource
* @param null \$valueNull
Expand Down
6 changes: 6 additions & 0 deletions tests/Zephir/Stubs/MethodDocBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ public function docBlockProvider(): array
" * \"test\" => \"xyz\"\n".
' * ]',
],
'with square brackets array syntax' => [
// Zep
'@param Foo[] $name - some description',
// php
'@param Foo[] $name - some description',
],
];
}

Expand Down

0 comments on commit a5f31d8

Please sign in to comment.