-
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathFileWithClasses84.php
More file actions
69 lines (57 loc) · 2.32 KB
/
FileWithClasses84.php
File metadata and controls
69 lines (57 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Parser Reflection API
*
* @copyright Copyright 2025, Lisachenko Alexander <lisachenko.it@gmail.com>
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
declare(strict_types=1);
namespace Go\ParserReflection\Stub;
/**
* @see https://wiki.php.net/rfc/property-hooks
*/
class ClassWithPhp84PropertyHooks
{
private string $backing = 'default';
public string $name {
get => $this->backing;
set => $this->backing = strtoupper($value);
}
}
/* Not supported yet
interface InterfaceWithPhp84AbstractProperty
{
public string $name { get; }
}
*/
/**
* https://wiki.php.net/rfc/asymmetric-visibility-v2
*/
class ClassWithPhp84AsymmetricVisibility
{
// These create a public-read, protected-write, write-once property.
public protected(set) readonly string $explicitPublicWriteOnceProtectedProperty;
public readonly string $implicitPublicReadonlyWriteOnceProperty;
readonly string $implicitReadonlyWriteOnceProperty;
// These creates a public-read, private-set, write-once, final property.
public private(set) readonly string $explicitPublicWriteOncePrivateProperty;
private(set) readonly string $implicitPublicReadonlyWriteOncePrivateProperty;
// These create a public-read, public-write, write-once property.
// While use cases for this configuration are likely few,
// there's no intrinsic reason it should be forbidden.
public public(set) readonly string $explicitPublicWriteOncePublicProperty;
public(set) readonly string $implicitPublicReadonlyWriteOncePublicProperty;
// These create a private-read, private-write, write-once, final property.
private private(set) readonly string $explicitPrivateWriteOncePrivateProperty;
private readonly string $implicitPrivateReadonlyWriteOncePrivateProperty;
// These create a protected-read, protected-write, write-once property.
protected protected(set) readonly string $explicitProtectedWriteOnceProtectedProperty;
protected readonly string $implicitProtectedReadonlyWriteOnceProtectedProperty;
public function __construct(
private(set) string $promotedPrivateSetStringProperty,
protected(set) string $promotedProtectedSetStringProperty,
protected private(set) int $promotedProtectedPrivateSetIntProperty,
) {}
}