Skip to content

Commit 746c319

Browse files
authored
Merge pull request #275 from PHPCSStandards/develop
Release PHPCSExtra 1.1.2
2 parents 98bcdba + 862b249 commit 746c319

File tree

8 files changed

+59
-15
lines changed

8 files changed

+59
-15
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ Please include as many details as relevant about the environment you experienced
5959
You should be able to get the version numbers using the `composer info` command.
6060
-->
6161

62-
| Environment | Answer
63-
| ------------------------ | -------
64-
| PHP version | x.y.z
65-
| PHP_CodeSniffer version | x.y.z
66-
| PHPCSExtra version | x.y.z
67-
| PHPCSUtils version | x.y.z
68-
| Install type | e.g. Composer global, Composer project local, git clone, other (please expand)
62+
| Environment | Answer |
63+
|-------------------------|--------------------------------------------------------------------------------|
64+
| PHP version | x.y.z |
65+
| PHP_CodeSniffer version | x.y.z |
66+
| PHPCSExtra version | x.y.z |
67+
| PHPCSUtils version | x.y.z |
68+
| Install type | e.g. Composer global, Composer project local, git clone, other (please expand) |
6969

7070

7171
## Additional Context (optional)

.github/workflows/basics.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout code
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3030

3131
- name: Install PHP
3232
uses: shivammathur/setup-php@v2
@@ -101,7 +101,7 @@ jobs:
101101

102102
steps:
103103
- name: Checkout code
104-
uses: actions/checkout@v3
104+
uses: actions/checkout@v4
105105

106106
- name: Install PHP
107107
uses: shivammathur/setup-php@v2
@@ -128,7 +128,7 @@ jobs:
128128

129129
steps:
130130
- name: Checkout code
131-
uses: actions/checkout@v3
131+
uses: actions/checkout@v4
132132

133133
- name: Set up node and enable caching of dependencies
134134
uses: actions/setup-node@v3
@@ -190,7 +190,7 @@ jobs:
190190

191191
steps:
192192
- name: Checkout code
193-
uses: actions/checkout@v3
193+
uses: actions/checkout@v4
194194

195195
# Ref: https://yamllint.readthedocs.io/en/stable/
196196
- name: Run Yamllint on all yaml files in repo

.github/workflows/quicktest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Checkout code
38-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
3939

4040
# On stable PHPCS versions, allow for PHP deprecation notices.
4141
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
steps:
4343
- name: Checkout code
44-
uses: actions/checkout@v3
44+
uses: actions/checkout@v4
4545

4646
# On stable PHPCS versions, allow for PHP deprecation notices.
4747
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
@@ -122,7 +122,7 @@ jobs:
122122

123123
steps:
124124
- name: Checkout code
125-
uses: actions/checkout@v3
125+
uses: actions/checkout@v4
126126

127127
# On stable PHPCS versions, allow for PHP deprecation notices.
128128
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.

.remarkrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"remark-lint-no-duplicate-definitions",
2222
"remark-lint-no-empty-url",
2323
"remark-lint-no-file-name-consecutive-dashes",
24-
"remark-lint-no-file-name-irregular-characters",
24+
["remark-lint-no-file-name-irregular-characters", "\\.a-zA-Z0-9_-"],
2525
"remark-lint-no-file-name-outer-dashes",
2626
"remark-lint-no-heading-like-paragraph",
2727
"remark-lint-no-literal-urls",

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
1414

1515
_Nothing yet._
1616

17+
## [1.1.2] - 2023-09-21
18+
19+
### Changed
20+
21+
#### Other
22+
23+
* Various housekeeping.
24+
25+
### Fixed
26+
27+
#### Universal
28+
29+
* `Universal.CodeAnalysis.ConstructorDestructorReturn`: the sniff will now correctly ignore methods mirroring the class name (PHP-4 style constructors) in namespaced code. [#207], [#272]
30+
31+
[#272]: https://github.com/PHPCSStandards/PHPCSExtra/pull/272
32+
33+
1734
## [1.1.1] - 2023-08-26
1835

1936
### Changed
@@ -506,6 +523,7 @@ This initial alpha release contains the following sniffs:
506523
[php_version-config]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version
507524

508525
[Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD
526+
[1.1.2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.1...1.1.2
509527
[1.1.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.0...1.1.1
510528
[1.1.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.4...1.1.0
511529
[1.0.4]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.3...1.0.4

Universal/Sniffs/CodeAnalysis/ConstructorDestructorReturnSniff.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use PHPCSUtils\Tokens\Collections;
1919
use PHPCSUtils\Utils\FunctionDeclarations;
2020
use PHPCSUtils\Utils\GetTokensAsString;
21+
use PHPCSUtils\Utils\Namespaces;
2122
use PHPCSUtils\Utils\NamingConventions;
2223
use PHPCSUtils\Utils\ObjectDeclarations;
2324
use PHPCSUtils\Utils\Scopes;
@@ -105,6 +106,17 @@ public function process(File $phpcsFile, $stackPtr)
105106
return;
106107
}
107108

109+
if (Namespaces::determineNamespace($phpcsFile, $stackPtr) !== '') {
110+
/*
111+
* Namespaced methods with the same name as the class are treated as
112+
* regular methods, so we can bow out if we're in a namespace.
113+
*
114+
* Note: the exception to this is PHP 5.3.0-5.3.2. This is currently
115+
* not dealt with.
116+
*/
117+
return;
118+
}
119+
108120
$functionType = 'A PHP 4-style constructor';
109121
}
110122

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
/*
4+
* The PHP4-style constructors are not constructors in namespaced files.
5+
* No errors should be thrown for it, nor any auto-fixes made.
6+
*/
7+
namespace Some\Name;
8+
9+
class ReturnsAValue {
10+
function returnsAValue(): string
11+
{
12+
return 'php4style';
13+
}
14+
}

0 commit comments

Comments
 (0)