-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/3.x'
- Loading branch information
Showing
10 changed files
with
196 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
tests/Go/Instrument/Transformer/_files/file-with-self-no-namespace-transformed.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** @noinspection PhpIllegalPsrClassPathInspection */ | ||
declare(strict_types=1); | ||
|
||
class ClassWithSelfNoNamespace extends \Exception | ||
{ | ||
const CLASS_CONST = \ClassWithSelfNoNamespace::class; | ||
|
||
private static $foo = 42; | ||
|
||
private \ClassWithSelfNoNamespace $instance; | ||
|
||
public function acceptsAndReturnsSelf(\ClassWithSelfNoNamespace $instance): \ClassWithSelfNoNamespace | ||
{ | ||
return $instance; | ||
} | ||
|
||
public function containsClosureWithSelf() | ||
{ | ||
$func = function (\ClassWithSelfNoNamespace $instance): \ClassWithSelfNoNamespace { | ||
return $instance; | ||
}; | ||
$func($this); | ||
} | ||
|
||
public function staticMethodCall() | ||
{ | ||
return \ClassWithSelfNoNamespace::staticPropertyAccess(); | ||
} | ||
|
||
public function classConstantFetch() | ||
{ | ||
return \ClassWithSelfNoNamespace::class . \ClassWithSelfNoNamespace::CLASS_CONST; | ||
} | ||
|
||
public static function staticPropertyAccess() | ||
{ | ||
return self::$foo; | ||
} | ||
|
||
public function newInstanceCreation() | ||
{ | ||
return new \ClassWithSelfNoNamespace; | ||
} | ||
|
||
public function catchSection() | ||
{ | ||
try { | ||
throw new \ClassWithSelfNoNamespace; | ||
} catch (\ClassWithSelfNoNamespace $exception) { | ||
// Nop | ||
} | ||
} | ||
|
||
public function instanceCheck() | ||
{ | ||
if ($this instanceof \ClassWithSelfNoNamespace) { | ||
// Nop | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
tests/Go/Instrument/Transformer/_files/file-with-self-no-namespace.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** @noinspection PhpIllegalPsrClassPathInspection */ | ||
declare(strict_types=1); | ||
|
||
class ClassWithSelfNoNamespace extends \Exception | ||
{ | ||
const CLASS_CONST = self::class; | ||
|
||
private static $foo = 42; | ||
|
||
private self $instance; | ||
|
||
public function acceptsAndReturnsSelf(self $instance): self | ||
{ | ||
return $instance; | ||
} | ||
|
||
public function containsClosureWithSelf() | ||
{ | ||
$func = function (self $instance): self { | ||
return $instance; | ||
}; | ||
$func($this); | ||
} | ||
|
||
public function staticMethodCall() | ||
{ | ||
return self::staticPropertyAccess(); | ||
} | ||
|
||
public function classConstantFetch() | ||
{ | ||
return self::class . self::CLASS_CONST; | ||
} | ||
|
||
public static function staticPropertyAccess() | ||
{ | ||
return self::$foo; | ||
} | ||
|
||
public function newInstanceCreation() | ||
{ | ||
return new self; | ||
} | ||
|
||
public function catchSection() | ||
{ | ||
try { | ||
throw new self; | ||
} catch (self $exception) { | ||
// Nop | ||
} | ||
} | ||
|
||
public function instanceCheck() | ||
{ | ||
if ($this instanceof self) { | ||
// Nop | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php /** @noinspection PhpIllegalPsrClassPathInspection */ | ||
|
||
|
||
class ClassWithoutNamespace | ||
{ | ||
public function publicMethod(): int | ||
{ | ||
return 1; | ||
} | ||
|
||
} |