Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated ReflectionParameter::getClass() #1440

Merged
merged 13 commits into from
Nov 16, 2020

Conversation

jawira
Copy link
Contributor

@jawira jawira commented Nov 16, 2020

In PHP 8 the method ReflectionParameter::getClass() has been deprecated. This method is used multiple times in \IntrospectionHelper class.

You can see deprecation messages running Phing with -debug flag (and using PHP 8 of course):

<?xml version="1.0" encoding="UTF-8" ?>

<project name="Deprecated getClass" default="demo" phingVersion="3">

    <target name="demo">
        <phplint>
            <fileset dir="classes">
                <include name="*.dummy"/>
            </fileset>
        </phplint>
    </target>

</project>
$ bin/phing -debug

(LOT OF LOG HERE)

demo > demo:

BuildEvent[source=demo]
BuildEvent[source=UnknownElement]
  +Task: phplint
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
    -calling adder PhpLintTask::addFileSet()
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 442 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 244 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 335 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
    -calling setter AbstractFileSet::setDir()
    -calling creator AbstractFileSet::createInclude()
[PHP Error] Method ReflectionParameter::getClass() is deprecated [line 335 of /home/jawira/PhpstormProjects/fork-phing/classes/phing/IntrospectionHelper.php]
    -calling setter PatternSetNameEntry::setName()
FileSet: Setup file scanner in dir classes with patternSet{ includes: *.dummy  excludes: empty }
BuildEvent[source=UnknownElement]
BuildEvent[source=demo]

BUILD FINISHED

Total time: 0.1441 seconds

As usual I'm open to any comment or suggestion.

Reference:

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #1440 (e9931a9) into master (20a3ba4) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1440      +/-   ##
============================================
- Coverage     54.24%   54.22%   -0.03%     
- Complexity     9135     9137       +2     
============================================
  Files           467      467              
  Lines         22199    22191       -8     
============================================
- Hits          12041    12032       -9     
- Misses        10158    10159       +1     
Impacted Files Coverage Δ Complexity Δ
classes/phing/IntrospectionHelper.php 68.72% <100.00%> (-0.97%) 87.00 <0.00> (+2.00) ⬇️
classes/phing/filters/TidyFilter.php 0.00% <0.00%> (ø) 15.00% <0.00%> (ø%)
classes/phing/filters/IconvFilter.php 0.00% <0.00%> (ø) 14.00% <0.00%> (ø%)
classes/phing/filters/XincludeFilter.php 0.00% <0.00%> (ø) 15.00% <0.00%> (ø%)
classes/phing/filters/TranslateGettext.php 0.00% <0.00%> (ø) 25.00% <0.00%> (ø%)
classes/phing/types/selectors/NotSelector.php 0.00% <0.00%> (ø) 4.00% <0.00%> (ø%)
classes/phing/types/selectors/SizeSelector.php 0.00% <0.00%> (ø) 44.00% <0.00%> (ø%)
classes/phing/types/selectors/DepthSelector.php 0.00% <0.00%> (ø) 23.00% <0.00%> (ø%)
classes/phing/types/selectors/DependSelector.php 0.00% <0.00%> (ø) 16.00% <0.00%> (ø%)
classes/phing/types/selectors/ExtendSelector.php 0.00% <0.00%> (ø) 16.00% <0.00%> (ø%)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20a3ba4...e9931a9. Read the comment docs.

@siad007 siad007 merged commit 08be1bb into phingofficial:master Nov 16, 2020
@jawira jawira deleted the fix-deprecated-getclass branch November 24, 2020 10:16
mpdude added a commit to webfactory/phing that referenced this pull request Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants