-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHP 8.2: Non-final classes without
#[AllowDynamicProperties]
might …
…still have dynamic properties Closes phpstan/phpstan#8727 Closes phpstan/phpstan#8474
- Loading branch information
1 parent
279c781
commit 051b06e
Showing
11 changed files
with
248 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Bug8474; | ||
|
||
class World {} | ||
class HelloWorld extends World { | ||
public string $hello = 'world'; | ||
} | ||
|
||
function hello(World $world): bool { | ||
return property_exists($world, 'hello'); | ||
} | ||
|
||
class Alpha | ||
{ | ||
public function __construct() | ||
{ | ||
if (property_exists($this, 'data')) { | ||
$this->data = 'Hello'; | ||
} | ||
} | ||
} | ||
|
||
class Beta extends Alpha | ||
{ | ||
/** @var string|null */ | ||
public $data = null; | ||
} | ||
|
||
class Delta extends Alpha | ||
{ | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Bug8727; | ||
|
||
abstract class Foo | ||
{ | ||
abstract public function hello(): void; | ||
|
||
protected function message(): string | ||
{ | ||
if (property_exists($this, 'lala')) { | ||
return 'Lala!'; | ||
} | ||
|
||
return 'Hello!'; | ||
} | ||
} | ||
|
||
class Bar extends Foo { | ||
protected bool $lala = true; | ||
|
||
public function hello(): void | ||
{ | ||
echo $this->message(); | ||
} | ||
} |
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
Oops, something went wrong.