Skip to content

Commit

Permalink
Merge pull request #8177 from junichi11/php84-asymmetric-visibility-v2
Browse files Browse the repository at this point in the history
PHP 8.4 Support: Asymmetric Visibility v2
  • Loading branch information
junichi11 authored Jan 23, 2025
2 parents c548664 + da5c988 commit 1992b69
Show file tree
Hide file tree
Showing 871 changed files with 118,966 additions and 63,395 deletions.
2 changes: 1 addition & 1 deletion php/php.api.phpmodule/manifest.mf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.php.api.phpmodule
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/api/phpmodule/resources/Bundle.properties
OpenIDE-Module-Specification-Version: 2.100
OpenIDE-Module-Specification-Version: 2.101
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ public boolean hasNeverType() {
return this.compareTo(PhpVersion.PHP_81) >= 0;
}

/**
* Check whether this version supports final const. (as of PHP 8.1)
*
* @return {@code true} if this version supports final const, {@code false}
* otherwise
* @since 2.101
*/
public boolean hasFinalConst() {
return this.compareTo(PhpVersion.PHP_81) >= 0;
}

/**
* Check whether this version supports the null, false, and true types.
*
Expand Down Expand Up @@ -283,6 +294,48 @@ public boolean hasOverrideAttribute() {
return this.compareTo(PhpVersion.PHP_83) >= 0;
}

/**
* Check whether this version supports [#\Deprecated] attribute. (as of PHP
* 8.4)
*
* @return {@code true} if this version supports [#\Deprecated] attribute,
* {@code false} otherwise
* @since 2.101
*/
public boolean hasDeprecatedAttribute() {
return this.compareTo(PhpVersion.PHP_84) >= 0;
}

/**
* Check whether this version supports final property(field). (as of PHP
* 8.4) e.g. `final public string $s;`
*
* @return {@code true} if this version supports final property,
* {@code false} otherwise
* @see
* <a href="https://www.php.net/manual/ja/language.oop5.final.php">Final
* Keyword</a>
* @since 2.101
*/
public boolean hasFinalProperty() {
return this.compareTo(PhpVersion.PHP_84) >= 0;
}

/**
* Check whether this version supports Asymmetric Visibility. (as of PHP
* 8.4) e.g. `private(set)`, `protected(set)`
*
* @return {@code true} if this version supports Asymmetric Visibility,
* {@code false} otherwise
* @see
* <a href="https://wiki.php.net/rfc/asymmetric-visibility-v2">Asymmetric
* Visibility v2</a>
* @since 2.101
*/
public boolean hasAsymmetricVisibility() {
return this.compareTo(PhpVersion.PHP_84) >= 0;
}

/**
* Check whether this is supported version yet by PHP official.
*
Expand Down
4 changes: 2 additions & 2 deletions php/php.editor/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
javac.source=1.8
javac.release=17
javac.compilerargs=-Xlint -Xlint:-serial
nbjavac.ignore.missing.enclosing=**/CUP$ASTPHP5Parser$actions.class
nbm.needs.restart=true
spec.version.base=2.43.0
spec.version.base=2.44.0
release.external/predefined_vars-1.0.zip=docs/predefined_vars.zip
sigtest.gen.fail.on.error=false

Expand Down
2 changes: 1 addition & 1 deletion php/php.editor/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>2.100</specification-version>
<specification-version>2.101</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public final class PhpModifiers extends Modifier {
public static final String VISIBILITY_PUBLIC = "public"; // NOI18N
public static final String VISIBILITY_PRIVATE = "private"; // NOI18N
public static final String VISIBILITY_PROTECTED = "protected"; // NOI18N
public static final String VISIBILITY_PUBLIC_SET = "public(set)"; // NOI18N
public static final String VISIBILITY_PRIVATE_SET = "private(set)"; // NOI18N
public static final String VISIBILITY_PROTECTED_SET = "protected(set)"; // NOI18N

public static final String STATIC_MODIFIER = "static"; // NOI18N
public static final String FINAL_MODIFIER = "final"; // NOI18N
public static final String ABSTRACT_MODIFIER = "abstract"; // NOI18N
public static final String READONLY_MODIFIER = "readonly"; // NOI18N
Expand Down Expand Up @@ -71,6 +75,39 @@ public PhpModifiers setProtected() {
return this;
}

/**
* Set public(set) to a modifier.
*
* @return {@link PhpModifiers}
* @since 2.44.0
*/
public PhpModifiers setPublicSet() {
mod |= Modifier.PUBLIC_SET;
return this;
}

/**
* Set private(set) to a modifier.
*
* @return {@link PhpModifiers}
* @since 2.44.0
*/
public PhpModifiers setPrivateSet() {
mod |= Modifier.PRIVATE_SET;
return this;
}

/**
* Set protected(set) to a modifier.
*
* @return {@link PhpModifiers}
* @since 2.44.0
*/
public PhpModifiers setProtectedSet() {
mod |= Modifier.PROTECTED_SET;
return this;
}

public PhpModifiers setStatic() {
mod |= Modifier.STATIC;
return this;
Expand Down Expand Up @@ -141,6 +178,42 @@ public boolean isProtected() {
return Modifier.isProtected(mod);
}

/**
* Check whether a modifier is public(set).
*
* @return {@code true} if a modifier is public(set), {@code false}
* otherwise
* @since 2.44.0
*/
public boolean isPublicSet() {
// public(set)
return Modifier.isPublicSet(mod);
}

/**
* Check whether a modifier is private(set).
*
* @return {@code true} if a modifier is private(set), {@code false}
* otherwise
* @since 2.44.0
*/
public boolean isPrivateSet() {
// private(set)
return Modifier.isPrivateSet(mod);
}

/**
* Check whether a modifier is protected(set).
*
* @return {@code true} if a modifier is protected(set), {@code false}
* otherwise
* @since 2.44.0
*/
public boolean isProtectedSet() {
// protected(set)
return Modifier.isProtectedSet(mod);
}

public boolean isStatic() {
return Modifier.isStatic(mod);
}
Expand Down
Loading

0 comments on commit 1992b69

Please sign in to comment.