== Why is this an issue?

The `var` keyword in PHP was historically used to declare class properties with default public visibility.
However, its usage is discouraged as it lacks clarity and explicit visibility declaration.

Instead, PHP introduced the keywords `public`, `protected`, and `private` to clearly define the visibility of class properties.
This enhances code readability and maintainability, as it becomes easier to understand and control access to class members.
Additionally, using the keywords for explicit visibility helps prevent unintended modifications or security vulnerabilities that may arise from the ambiguity of the `var` keyword.


=== Noncompliant code example

[source,php,diff-id=1,diff-type=noncompliant]
----
<?php
class Foo
{
    var $bar = 1;
}
----


=== Compliant solution

[source,php,diff-id=1,diff-type=compliant]
----
<?php
class Foo
{
    public $bar = 1;
}
----

== Resources
=== Documentation
* https://www.php.net/manual/en/language.oop5.visibility.php[PHP Manual - Visibility]
* https://www.w3schools.com/php/keyword_var.asp#:~:text=The%20var%20keyword%20creates%20a,public%20should%20be%20used%20instead[W3Schools - var Keyword]


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Replace the "var" keyword with the modifier "public".


'''
== Comments And Links
(visible only on this page)

=== on 27 May 2014, 20:01:53 Ann Campbell wrote:
The reference I found has a slightly different reading on the deprecation: \http://www.php.net/manual/en/language.oop5.properties.php

endif::env-github,rspecator-view[]
