Skip to content

Commit

Permalink
Merge pull request #3495 from soyuka/2.5
Browse files Browse the repository at this point in the history
Fix cs, use static::class instead of get_class($this)
  • Loading branch information
soyuka committed Apr 16, 2020
2 parents bc52cac + c0e5a37 commit 3716126
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
12 changes: 1 addition & 11 deletions .php_cs.dist
Expand Up @@ -108,16 +108,6 @@ return PhpCsFixer\Config::create()
'property',
],
],
'void_return' => false, // BC breaks; to be done in API Platform 3.0,
// removed get_class_this see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4921
'function_to_constant' => [
'functions' => [
'get_called_class',
'get_class',
'php_sapi_name',
'phpversion',
'pi'
]
]
'void_return' => false, // BC breaks; to be done in API Platform 3.0
])
->setFinder($finder);
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Expand Up @@ -28,6 +28,10 @@ parameters:
path: src/Identifier/Normalizer/IntegerDenormalizer.php

# False positives
-
message: '#Strict comparison using !== between .+ and .+ will always evaluate to false\.#'
paths:
- src/Bridge/Doctrine/Common/PropertyHelperTrait.php
-
message: '#Variable \$iri might not be defined\.#'
path: src/JsonApi/Serializer/ItemNormalizer.php
Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/Doctrine/Common/PropertyHelperTrait.php
Expand Up @@ -52,7 +52,7 @@ protected function isPropertyNested(string $property/*, string $resourceClass*/)
if (\func_num_args() > 1) {
$resourceClass = (string) func_get_arg(1);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
Expand Down Expand Up @@ -91,7 +91,7 @@ protected function splitPropertyParts(string $property/*, string $resourceClass*

if (\func_num_args() > 1) {
$resourceClass = func_get_arg(1);
} elseif (__CLASS__ !== \get_class($this)) {
} elseif (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/AbstractFilter.php
Expand Up @@ -101,7 +101,7 @@ protected function isPropertyEnabled(string $property/*, string $resourceClass*/
if (\func_num_args() > 1) {
$resourceClass = func_get_arg(1);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/ExistsFilter.php
Expand Up @@ -74,7 +74,7 @@ protected function filterProperty(string $property, $value, QueryBuilder $queryB
if (\func_num_args() > 6) {
$context = func_get_arg(6);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/Doctrine/Orm/PropertyHelperTrait.php
Expand Up @@ -45,7 +45,7 @@ protected function addJoinsForNestedProperty(string $property, string $rootAlias
if (\func_num_args() > 4) {
$resourceClass = func_get_arg(4);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
Expand All @@ -57,7 +57,7 @@ protected function addJoinsForNestedProperty(string $property, string $rootAlias
if (\func_num_args() > 5) {
$joinType = func_get_arg(5);
} else {
if (__CLASS__ !== \get_class($this)) {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
@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);
Expand Down

0 comments on commit 3716126

Please sign in to comment.