Proposal for "ProtectedMembers"

» Metadata » Status
  • Category: RFC
  • Proposer: Aidan Lister 
  • License: Apache License
» Description

Premace:

This RFC aims to resolve whether or not protected class members will be prefixed with an underscore, or prefixed with nothing.

Once a decision has been reached, the result will be added to the PEAR coding standards.

Private members will still be prefixed.

These standards will only apply to PHP5 classes. In PHP4, if it's not public it's private and thus prefixed.

Voting:

A vote of +1 suggests class members should not be prefixed.
<php>
class Foo {
protected $somevar;
protected function somefunc();
}

</php>

A vote of -1 suggests class members should be prefixed with an underscore.
<php>
class Foo {
protected $_somevar;
protected function _somefunc();
}

</php>

A vote of 0 will not be counted.

If the overall score at the end of the call-for-votes is positive, class members will not be prefixed. If negative, they will be prefixed.

Information:

What's changed?

PHP5 Introduces PPP - Private, Public and Protected.

What's protected and private?

Protected members can be accessed in classes extending the class they are declared in, where as private members can only be accessed by the class they belong to.

What did we use to do, and why?

In PHP4, both private and protected members were prefixed with an underscore. This was to ensure the user of the class knew what methods were available to them, and not to mess with anything else.

One of the key reasons for prefixed members is the visual expression of "Do not mess with this member, I may remove/rename it in the future". This is fine for private members, however will not follow for protected members when the class is extended by the user.

Is it possible to accidently ignore the declarations?

If a member is declared as protected (using the protected keyword), an E_FATAL error will be thrown if the member is used incorrectly.

PHP5 will also provide errors if a user attempts to redeclare a
protected var as private. However protected members may be declared public by child classes.

In this regard 'protected' is like public in terms of the obligations of
the library author. For example, if you want to keep your public API small, but allow extending classes to expose more functionality. Or, if you would prefer to access class properties directly rather than using setter methods, you can redeclare the properties public in a child class.

In these situations, public vars would be prefixed as "private".

Does prefixing enhance readability?

Some would argue yes, some would argue no. Most large classes consist almost completely of protected members, with the public members reserved for the API.
In this situation, does having almost everything underscored really enhance readability?

Is private the same as protected? No, definitly not. Then why should it be prefixed the same? Some argue this actually decreases readability and confuses private members.

Is protected the same as public? No, definitly not. The user can't use a protected member (unless they are extending the class). In this example, protected has a lot more in common private. Should the user be protected visually (as well as with the language construct) from using protected members?
KMSPico is the most effective Win's&Office KMS Activator

Is dealing with drawn-out and difficult Office&Windows activation processes becoming too much for you?Search no more, as KMSPico is here to simplify your life.You may quickly activate your Windows OS and MSOffice suite with only a few clicks and no complicated processes or technical knowledge by using this efficient approach.

How am I supposed to utilize KMSPico?

Software activation applications such as KMSPico are widely used to activate MSOffice and Windows apps.The idea is to circumvent the product key validation process in order to activate these software programs for free.It's easy to use and generally safe because the application doesn't include any harmful components that might harm your computer.?

Aspects of KMSPico

For Windows&MSOffice users, KMS Pico is an essential application due to its many functions.

Free Activation: Activating your Windows&Office applications without having to pay for expensive licenses is one of KMSPico's primary advantages. This saves you the trouble.?
Long-Term Initiation: Some activation approaches require regular reactivation; however, KMSPico provides a permanent activation alternative. Your copy of Windows&Office will remain active forever after it is activated.
Multiple Versions are Supported: KMSPico is compatible with several MS Office versions as well as Windows 7, 8, 8.1, 10, and more.
Off Activation: If you don't have internet access, you may use KMSPico to activate your Office or Windows program offline.
Secure and Safe: Nothing in KMSPico might harm your computer, including malware or spyware. It is advisable to get software from a reputable source in order to verify its authenticity.

Utilizing KMSPico

You may use KMSPico to easily activate your Office&Windows applications.

First, be cautious to turn off Win Defender and antivirus software for the time being, since these tools can incorrectly flag KMS Pico as a danger because of its activation method.
Download the KMS-Pico program from a reliable website.?
Extract the contents of the downloaded file using the appropriate extraction software.?
Run the KMSPico installation file (.exe) and follow the on-screen instructions to complete the installation.?
Once installation is complete, run KMS Pico as an administrator.?
To start the activation procedure, click the "Activ" button.?
Hold off till KMS Pico has finished activating for a few seconds.
When it has been successfully enabled, you will get a confirmation message.?
In order to effect the modifications, restart your computer.?

Is it lawful, KMSPico?

It is important to keep in mind that it is against Microsoft's agreements and regulations to use KMSPICO to activate Windows&Office applications.Even if a lot of people choose to use this tool due of its convenience and cost-saving benefits, it is advised to get legitimate licenses in order to assist the developers and uphold compliance with licensing agreements.

Because unlicensed software does not receive regular updates and fixes from Microsoft, it increases the risk of security breaches on your machine. These updates often contain important security patches that protect your system from vulnerabilities.

With the powerful activation tool KMSPico, it is possible to swiftly and simply activate the Windows operating system and Microsoft Office suite.Even if using unlicensed software offers numerous benefits, such as free and perpetual activation, it's important to consider the security and legal implications.Obtaining valid licenses is often encouraged in order to support the authors and maintain compliance and security for your computer system.

» Dependencies » Links
» Timeline » Changelog
  • First Draft: 2004-06-24
  • Proposal: 2004-06-26
  • Call for Votes: 2004-07-03
  • Thies C. Arntzen
    [2023-08-23 20:16 UTC]

  • Thies C. Arntzen
    [2023-09-13 10:05 UTC]

  • Thies C. Arntzen
    [2023-10-14 14:24 UTC]

  • Thies C. Arntzen
    [2023-10-14 14:28 UTC]