Commit Graph

33 Commits

Author SHA1 Message Date
Gina Peter Bnayard
d015af60df ext/phar: Adjust return types for methods that always return true 2024-08-23 17:42:37 +01:00
Máté Kocsis
b06c95b631
Declare the missing true return types (#13709) 2024-03-16 07:26:37 +01:00
Máté Kocsis
577db99462
Verify stub aliases in CI (#13682)
In the same time, let's not verify implementation aliases since they may now legitimately differ from their aliased function/method counterparts (think about the ext/dom refactoring where e.g. many return type declarations have changed). Additionally, unnecessary `@no-verify` tags are cleaned up.
2024-03-13 23:32:35 +01:00
Ayesh Karunaratne
1887f02b0b
Add class constant types to Phar extension (#11826) 2023-08-21 07:14:45 +02:00
Máté Kocsis
6ab897c8d3
Declare ext/phar constants in stubs (#9094) 2022-07-22 13:09:23 +02:00
George Peter Banyard
be2500f229
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix param name order for Phar::copy()
2021-09-08 12:32:58 +01:00
George Peter Banyard
0d0c9acafb
Fix param name order for Phar::copy() 2021-09-08 12:31:09 +01:00
Nikita Popov
edb6b375dd Don't return bool from Phar::offsetUnset()
This violates the ArrayAccess interface. Use offsetExists() to
check if an entry exists.
2021-07-16 16:39:27 +02:00
Nikita Popov
3fc3cfbad0 Fix Phar::offsetGet() return type
It's possible to change the returned type using setFileClass(),
which unfortunately only enforces that it's a subtype of
SplFileInfo, not PharFileInfo.
2021-07-13 12:02:05 +02:00
Máté Kocsis
83916e83b4
Declare tentative return types for ext/phar (#7052) 2021-05-28 15:07:15 +02:00
Máté Kocsis
0224cc83fc
Merge branch 'PHP-8.0'
* Add a few missing RETURN_THROWS();
* Fix a few ext/phar return types
2021-05-27 16:32:16 +02:00
Máté Kocsis
9bba9f68df Fix a few ext/phar return types 2021-05-27 16:31:18 +02:00
Máté Kocsis
5b5bfd6be4
Generate class entries from stubs for phar, posix, pspell, readline, reflection, session, shmop
Closes GH-6692
2021-02-15 00:11:22 +01:00
Nikita Popov
ccc70ec5d4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Make Phar $fileNotFoundScript nullable
2021-02-09 12:57:58 +01:00
Nikita Popov
44192ce80b Make Phar $fileNotFoundScript nullable
While "" is already treated the same way as absence, null is the
logically correct default here. Making this one argument non-nullable
is particularly pecular when considering that the preceding $alias
and $index arguments are both nullable.
2021-02-09 12:55:33 +01:00
Nikita Popov
a9efcb1561 gen_stub: Also verify implementation-alias
This makes --verify also check @implementation-alias. Failures are
ignored using @no-verify instead. Some mistakes have been made that
would have been caught by this...

Closes GH-6615.
2021-01-19 09:48:33 +01:00
Nikita Popov
48e2e5324e Fix parameter name of PharData::getMetadata()
The name should be the same as for Phar::getMetadata().
2021-01-18 14:09:00 +01:00
Dylan K. Taylor
0aad77418d Fix stub for Phar::setStub()
This fixes multiple issues:
 * The first parameter may be resource|string.
 * It's an overloaded signature. The second parameter cannot be
   passed if the first one is a string. Use UNKNOWN default
   value for that reason.
 * Make parameter names in PharData::setStub() match those in
   Phar.

Closes GH-6596.
2021-01-18 12:59:18 +01:00
Nikita Popov
82d46e353b Update ext/phar parameter names
Closes GH-6307.
2020-10-13 10:20:45 +02:00
Nikita Popov
ad7e231e81 Make compression_type nullable in a few more places
Missed that this was also used elsewhere...
2020-10-08 17:05:38 +02:00
Nikita Popov
9719d6cade Make Phar $format and $compression arguments nullable
Rather than using Greg's birthday, use null to indicate that the
existing format/compression should be retained. For the format
simply using zero would be sufficient, but as the documentation
explicitly says that NULL is allowed here, we may as well make
that the truth.
2020-10-08 13:12:22 +02:00
Máté Kocsis
64af12d13b
Add support for @implementation-alias in stubs
Closes GH-6170
2020-09-21 10:08:45 +02:00
Máté Kocsis
628db3f3b5
Fix UNKNOWN default values in various extensions
Closes GH-6075
2020-09-07 19:02:02 +02:00
Máté Kocsis
f7fbc6333f
Add more precise type info for stubs
Closes GH-6005
2020-09-01 16:35:56 +02:00
Máté Kocsis
be5ba20132
Promote warnings to exceptions in ext/phar
Closes GH-6008
2020-08-25 11:57:37 +02:00
Máté Kocsis
046cc5e4c2
Add another round of missing parameter types to stubs
Closes GH-5950
2020-08-07 16:48:45 +02:00
Tyson Andre
0c238ede01 [RFC] Only unserialize Phar metadata when getMetadata() is called
In other words, don't automatically unserialize when the magic
phar:// stream wrappers are used.
RFC: https://wiki.php.net/rfc/phar_stop_autoloading_metadata

Also, change the signature from `getMetadata()`
to `getMetadata(array $unserialize_options = [])`.
Start throwing earlier if setMetadata() is called and serialization threw.

See https://externals.io/message/110856 and
https://bugs.php.net/bug.php?id=76774

This was refactored to add a phar_metadata_tracker for the following reasons:
- The way to properly copy a zval was previously implicit and undocumented
  (e.g. is it a pointer to a raw string or an actual value)
- Avoid unnecessary serialization and unserialization in the most common case
- If a metadata value is serialized once while saving a new/modified phar file,
  this allows reusing the same serialized string.
- Have as few ways to copy/clone/lazily parse metadata (etc.) as possible,
  so that code changes can be limited to only a few places in the future.
- Performance is hopefully not a concern - copying a string should be faster
  than unserializing a value, and metadata should be rare in most cases.

Remove unnecessary skip in a test(Compression's unused)

Add additional assertions about usage of persistent phars

Improve robustness of `Phar*->setMetadata()`

- Add sanity checks for edge cases freeing metadata, when destructors
  or serializers modify the phar recursively.
- Typical use cases of php have phar.readonly=1 and would not be affected.

Closes GH-5855
2020-08-03 13:28:51 -04:00
Máté Kocsis
c6485535c2
Generate method entries from stubs for curl, ffi, pdo, phar
Closes GH-5375
2020-04-14 11:49:02 +02:00
Máté Kocsis
e088836bbc
Fix nullable types in PHPDoc 2020-04-12 00:25:33 +02:00
Nikita Popov
2bcc4ab8f4 Verify that all stubs have a return type 2020-04-03 17:59:30 +02:00
Nikita Popov
328903ca36 Add proper return types to final phar methods
As these are final, we can add return types to them.
2020-02-18 10:20:21 +01:00
Nikita Popov
169805777c Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply tidy formatting
2020-02-03 13:42:08 +01:00
Christoph M. Becker
4d067d811d Add ext/phar arginfo stubs 2019-11-02 11:55:11 +01:00