Skip to content

Commit 3716126

Browse files
authored
Merge pull request #3495 from soyuka/2.5
Fix cs, use static::class instead of get_class($this)
2 parents bc52cac + c0e5a37 commit 3716126

File tree

6 files changed

+11
-17
lines changed

6 files changed

+11
-17
lines changed

.php_cs.dist

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ return PhpCsFixer\Config::create()
108108
'property',
109109
],
110110
],
111-
'void_return' => false, // BC breaks; to be done in API Platform 3.0,
112-
// removed get_class_this see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4921
113-
'function_to_constant' => [
114-
'functions' => [
115-
'get_called_class',
116-
'get_class',
117-
'php_sapi_name',
118-
'phpversion',
119-
'pi'
120-
]
121-
]
111+
'void_return' => false, // BC breaks; to be done in API Platform 3.0
122112
])
123113
->setFinder($finder);

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ parameters:
2828
path: src/Identifier/Normalizer/IntegerDenormalizer.php
2929

3030
# False positives
31+
-
32+
message: '#Strict comparison using !== between .+ and .+ will always evaluate to false\.#'
33+
paths:
34+
- src/Bridge/Doctrine/Common/PropertyHelperTrait.php
3135
-
3236
message: '#Variable \$iri might not be defined\.#'
3337
path: src/JsonApi/Serializer/ItemNormalizer.php

src/Bridge/Doctrine/Common/PropertyHelperTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function isPropertyNested(string $property/*, string $resourceClass*/)
5252
if (\func_num_args() > 1) {
5353
$resourceClass = (string) func_get_arg(1);
5454
} else {
55-
if (__CLASS__ !== \get_class($this)) {
55+
if (__CLASS__ !== static::class) {
5656
$r = new \ReflectionMethod($this, __FUNCTION__);
5757
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
5858
@trigger_error(sprintf('Method %s() will have a second `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.', __FUNCTION__), E_USER_DEPRECATED);
@@ -91,7 +91,7 @@ protected function splitPropertyParts(string $property/*, string $resourceClass*
9191

9292
if (\func_num_args() > 1) {
9393
$resourceClass = func_get_arg(1);
94-
} elseif (__CLASS__ !== \get_class($this)) {
94+
} elseif (__CLASS__ !== static::class) {
9595
$r = new \ReflectionMethod($this, __FUNCTION__);
9696
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
9797
@trigger_error(sprintf('Method %s() will have a second `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.', __FUNCTION__), E_USER_DEPRECATED);

src/Bridge/Doctrine/Orm/Filter/AbstractFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function isPropertyEnabled(string $property/*, string $resourceClass*/
101101
if (\func_num_args() > 1) {
102102
$resourceClass = func_get_arg(1);
103103
} else {
104-
if (__CLASS__ !== \get_class($this)) {
104+
if (__CLASS__ !== static::class) {
105105
$r = new \ReflectionMethod($this, __FUNCTION__);
106106
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
107107
@trigger_error(sprintf('Method %s() will have a second `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.', __FUNCTION__), E_USER_DEPRECATED);

src/Bridge/Doctrine/Orm/Filter/ExistsFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB
7474
if (\func_num_args() > 6) {
7575
$context = func_get_arg(6);
7676
} else {
77-
if (__CLASS__ !== \get_class($this)) {
77+
if (__CLASS__ !== static::class) {
7878
$r = new \ReflectionMethod($this, __FUNCTION__);
7979
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
8080
@trigger_error(sprintf('Method %s() will have a seventh `$context` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.5.', __FUNCTION__), E_USER_DEPRECATED);

src/Bridge/Doctrine/Orm/PropertyHelperTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function addJoinsForNestedProperty(string $property, string $rootAlias
4545
if (\func_num_args() > 4) {
4646
$resourceClass = func_get_arg(4);
4747
} else {
48-
if (__CLASS__ !== \get_class($this)) {
48+
if (__CLASS__ !== static::class) {
4949
$r = new \ReflectionMethod($this, __FUNCTION__);
5050
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
5151
@trigger_error(sprintf('Method %s() will have a fifth `$resourceClass` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.1.', __FUNCTION__), E_USER_DEPRECATED);
@@ -57,7 +57,7 @@ protected function addJoinsForNestedProperty(string $property, string $rootAlias
5757
if (\func_num_args() > 5) {
5858
$joinType = func_get_arg(5);
5959
} else {
60-
if (__CLASS__ !== \get_class($this)) {
60+
if (__CLASS__ !== static::class) {
6161
$r = new \ReflectionMethod($this, __FUNCTION__);
6262
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
6363
@trigger_error(sprintf('Method %s() will have a sixth `$joinType` argument in version API Platform 3.0. Not defining it is deprecated since API Platform 2.3.', __FUNCTION__), E_USER_DEPRECATED);

0 commit comments

Comments
 (0)